ksvmuralidhar commited on
Commit
72ffb46
1 Parent(s): 139e080

Update api.py

Browse files
Files changed (1) hide show
  1. api.py +5 -19
api.py CHANGED
@@ -79,28 +79,14 @@ async def scrape_urls(urls):
79
  logging.warning('Exiting scrape_urls()')
80
  return scraped_texts, scrape_errors
81
 
82
- # async def scrape_urls(urls):
83
- # scraped_texts = []
84
- # scrape_errors = []
85
- # for url in urls:
86
- # text, err = await scrape_text(url)
87
- # scraped_texts.append(text)
88
- # scrape_errors.append(err)
89
- # return scraped_texts, scrape_errors
90
-
91
-
92
- ##### API #####
93
 
94
  description = """
95
  API to generate summaries of news articles from their URLs.
96
-
97
- ## generate_summary
98
-
99
- Enables a user to generate summary from input news articles URLs.
100
  """
101
 
102
 
103
- app = FastAPI(description=description,
 
104
  summary="News article summary generator",
105
  version="0.0.1",
106
  contact={
@@ -126,7 +112,7 @@ class SuccessfulResponse(BaseModel):
126
  scraped_texts: List[str] = Field(..., description="List of scraped text from input URLs")
127
  scrape_errors: List[str] = Field(..., description="List of errors raised during scraping. One item for corresponding URL")
128
  summaries: List[str] = Field(..., description="List of generated summaries of news articles")
129
- summarizer_error: str = Field("", description="Blank as the response code is 200")
130
 
131
  class AuthenticationError(BaseModel):
132
  urls: List[str] = Field(..., description="List of URLs of news articles inputted by the user")
@@ -137,8 +123,8 @@ class AuthenticationError(BaseModel):
137
 
138
  class SummaryError(BaseModel):
139
  urls: List[str] = Field(..., description="List of URLs of news articles inputted by the user")
140
- scraped_texts: List[str] = Field("", description="List of scraped text from input URLs")
141
- scrape_errors: List[str] = Field("", description="List of errors raised during scraping. One item for corresponding URL")
142
  summaries: str = Field("", description="Empty string as summarizer encountered an error")
143
  summarizer_error: str = Field("Error: Summarizer Error with a message describing the error")
144
 
 
79
  logging.warning('Exiting scrape_urls()')
80
  return scraped_texts, scrape_errors
81
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
  description = """
84
  API to generate summaries of news articles from their URLs.
 
 
 
 
85
  """
86
 
87
 
88
+ app = FastAPI(title='News Summarizer API',
89
+ description=description,
90
  summary="News article summary generator",
91
  version="0.0.1",
92
  contact={
 
112
  scraped_texts: List[str] = Field(..., description="List of scraped text from input URLs")
113
  scrape_errors: List[str] = Field(..., description="List of errors raised during scraping. One item for corresponding URL")
114
  summaries: List[str] = Field(..., description="List of generated summaries of news articles")
115
+ summarizer_error: str = Field("", description="Empty string as the response code is 200")
116
 
117
  class AuthenticationError(BaseModel):
118
  urls: List[str] = Field(..., description="List of URLs of news articles inputted by the user")
 
123
 
124
  class SummaryError(BaseModel):
125
  urls: List[str] = Field(..., description="List of URLs of news articles inputted by the user")
126
+ scraped_texts: List[str] = Field(..., description="List of scraped text from input URLs")
127
+ scrape_errors: List[str] = Field(..., description="List of errors raised during scraping. One item for corresponding URL")
128
  summaries: str = Field("", description="Empty string as summarizer encountered an error")
129
  summarizer_error: str = Field("Error: Summarizer Error with a message describing the error")
130