Spaces:
Sleeping
Sleeping
change summarize endpoint from GET to POST and return actual summary in response
Browse files
main.py
CHANGED
|
@@ -14,7 +14,7 @@ class TextInput(BaseModel):
|
|
| 14 |
async def root():
|
| 15 |
return {"message": "Welcome to the Text Summarization API!"}
|
| 16 |
|
| 17 |
-
@app.
|
| 18 |
async def summarize_text(input: TextInput):
|
| 19 |
-
summary =
|
| 20 |
-
return "
|
|
|
|
| 14 |
async def root():
|
| 15 |
return {"message": "Welcome to the Text Summarization API!"}
|
| 16 |
|
| 17 |
+
@app.post("/summarize") # Changed from GET to POST
|
| 18 |
async def summarize_text(input: TextInput):
|
| 19 |
+
summary = summarizer(input.text, max_length=130, min_length=30, do_sample=False)
|
| 20 |
+
return {"summary": summary[0]["summary_text"]} # Return the actual summary
|