iShare commited on
Commit
38465ad
1 Parent(s): 51f6298

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -3
main.py CHANGED
@@ -78,7 +78,9 @@ async def home():
78
 
79
  @app.post("/fastapi_file_upload_process")
80
  #async def upload_file(user_question: str, file_to_process: FileToProcess = Depends()):
81
- async def pdf_file_qa_process(user_question: str, request: Request, file_to_process: FileToProcess = Depends()):
 
 
82
  uploaded_file = file_to_process.uploaded_file
83
  print("File received:"+uploaded_file.filename)
84
 
@@ -174,7 +176,9 @@ async def pdf_file_qa_process(user_question: str, request: Request, file_to_proc
174
  new_final_ai_response = final_ai_response.split('Unhelpful Answer:')[0].strip()
175
  new_final_ai_response = new_final_ai_response.split('Note:')[0].strip()
176
  new_final_ai_response = new_final_ai_response.split('Please provide feedback on how to improve the chatbot.')[0].strip()
177
- print(new_final_ai_response)
178
-
 
 
179
  return {"AIResponse": new_final_ai_response}
180
  #return JSONResponse({"AIResponse": new_final_ai_response})
 
78
 
79
  @app.post("/fastapi_file_upload_process")
80
  #async def upload_file(user_question: str, file_to_process: FileToProcess = Depends()):
81
+ async def pdf_file_qa_process(user_question: str, request: Request, file_to_process: FileToProcess = Depends()):
82
+ print("API Call Triggered.")
83
+ start_0 = timeit.default_timer()
84
  uploaded_file = file_to_process.uploaded_file
85
  print("File received:"+uploaded_file.filename)
86
 
 
176
  new_final_ai_response = final_ai_response.split('Unhelpful Answer:')[0].strip()
177
  new_final_ai_response = new_final_ai_response.split('Note:')[0].strip()
178
  new_final_ai_response = new_final_ai_response.split('Please provide feedback on how to improve the chatbot.')[0].strip()
179
+ print(new_final_ai_response)
180
+ end_0 = timeit.default_timer()
181
+ print("API Call Ended.")
182
+ print(f'API Call共耗时: @ {end_0 - start_0}')
183
  return {"AIResponse": new_final_ai_response}
184
  #return JSONResponse({"AIResponse": new_final_ai_response})