zeeshan391 commited on
Commit
258f49c
1 Parent(s): d29e675

updated app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
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")