Spaces:
Sleeping
Sleeping
Update api.py
Browse files
api.py
CHANGED
@@ -14,7 +14,6 @@ import multiprocessing
|
|
14 |
|
15 |
|
16 |
os.environ['TF_USE_LEGACY_KERAS'] = "1"
|
17 |
-
|
18 |
SUMM_CHECKPOINT = "facebook/bart-base"
|
19 |
SUMM_INPUT_N_TOKENS = 400
|
20 |
SUMM_TARGET_N_TOKENS = 300
|
@@ -137,12 +136,18 @@ def authenticate_key(api_key: str):
|
|
137 |
raise NewsSummarizerAPIAuthenticationError("Authentication error: Invalid API key.")
|
138 |
|
139 |
|
140 |
-
@app.post("/generate_summary/", tags=
|
141 |
responses={
|
142 |
401: {"model": AuthenticationError, "description": "Authentication Error"},
|
143 |
500: {"model": SummaryError, "description": "Summarizer Error"}
|
144 |
})
|
145 |
async def read_items(q: URLList):
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
try:
|
147 |
logging.warning("Entering read_items()")
|
148 |
urls = ""
|
|
|
14 |
|
15 |
|
16 |
os.environ['TF_USE_LEGACY_KERAS'] = "1"
|
|
|
17 |
SUMM_CHECKPOINT = "facebook/bart-base"
|
18 |
SUMM_INPUT_N_TOKENS = 400
|
19 |
SUMM_TARGET_N_TOKENS = 300
|
|
|
136 |
raise NewsSummarizerAPIAuthenticationError("Authentication error: Invalid API key.")
|
137 |
|
138 |
|
139 |
+
@app.post("/generate_summary/", tags=[""], response_model=List[SuccessfulResponse],
|
140 |
responses={
|
141 |
401: {"model": AuthenticationError, "description": "Authentication Error"},
|
142 |
500: {"model": SummaryError, "description": "Summarizer Error"}
|
143 |
})
|
144 |
async def read_items(q: URLList):
|
145 |
+
"""
|
146 |
+
Get summaries of news articles by passing the list of URLs as input.
|
147 |
+
|
148 |
+
- **urls**: List of URLs (required)
|
149 |
+
- **key**: Authentication key (required)
|
150 |
+
"""
|
151 |
try:
|
152 |
logging.warning("Entering read_items()")
|
153 |
urls = ""
|