Spaces:
Sleeping
Sleeping
updated app.py
Browse files
app.py
CHANGED
@@ -91,7 +91,10 @@ async def generate_story(story_request: StoryRequest):
|
|
91 |
# return {"story": response}
|
92 |
# except Exception as e:
|
93 |
# raise HTTPException(status_code=500, detail=str(e))
|
94 |
-
response = chain.invoke(final_prompt)
|
|
|
|
|
|
|
95 |
|
96 |
if not response:
|
97 |
raise HTTPException(status_code=500, detail="Failed to generate the story")
|
|
|
91 |
# return {"story": response}
|
92 |
# except Exception as e:
|
93 |
# raise HTTPException(status_code=500, detail=str(e))
|
94 |
+
# response = chain.invoke(final_prompt)
|
95 |
+
# async for s in chain.astream(final_prompt):
|
96 |
+
# print(s.content, end="", flush=True)
|
97 |
+
response = await chain.ainvoke(final_prompt)
|
98 |
|
99 |
if not response:
|
100 |
raise HTTPException(status_code=500, detail="Failed to generate the story")
|