bluewhale2025 commited on
Commit
a118576
Β·
1 Parent(s): ac59367

Fix async/await issue in process_document function

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -104,7 +104,7 @@ async def health_check():
104
  "processed_dir": str(PROCESSED_DIR)
105
  }
106
 
107
- async def process_document(file_path: str):
108
  """
109
  Process a document by extracting text, summarizing it, and adding to the vector store.
110
 
@@ -195,7 +195,7 @@ async def search_documents(query: str, top_k: int = 5):
195
  except Exception as e:
196
  raise HTTPException(status_code=500, detail=str(e))
197
 
198
- # Gradio μΈν„°νŽ˜μ΄μŠ€ 생성
199
  def process_file(file_path):
200
  """Process the uploaded file and return the summary"""
201
  # file_path is already a string path from Gradio's type="filepath"
@@ -206,7 +206,7 @@ def process_file(file_path):
206
  result = process_document(file_path)
207
  return result.get("summary", "μš”μ•½μ„ 생성할 수 μ—†μŠ΅λ‹ˆλ‹€.")
208
  except Exception as e:
209
- logger.error(f"Error processing file: {str(e)}")
210
  return f"파일 처리 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€: {str(e)}"
211
 
212
  def search(query):
 
104
  "processed_dir": str(PROCESSED_DIR)
105
  }
106
 
107
+ def process_document(file_path: str):
108
  """
109
  Process a document by extracting text, summarizing it, and adding to the vector store.
110
 
 
195
  except Exception as e:
196
  raise HTTPException(status_code=500, detail=str(e))
197
 
198
+ # GradIO μΈν„°νŽ˜μ΄μŠ€ 생성
199
  def process_file(file_path):
200
  """Process the uploaded file and return the summary"""
201
  # file_path is already a string path from Gradio's type="filepath"
 
206
  result = process_document(file_path)
207
  return result.get("summary", "μš”μ•½μ„ 생성할 수 μ—†μŠ΅λ‹ˆλ‹€.")
208
  except Exception as e:
209
+ logger.error(f"Error processing file: {str(e)}", exc_info=True)
210
  return f"파일 처리 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€: {str(e)}"
211
 
212
  def search(query):