AIMS168 commited on
Commit
69b6673
Β·
verified Β·
1 Parent(s): 480c123

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -48,15 +48,15 @@ def process_pdf_upload(api_key, pdf_file):
48
  vectordb = load_and_process_pdf(pdf_file, api_key)
49
  if isinstance(vectordb, str):
50
  return vectordb
51
- return "PDF ε·²ζˆεŠŸθΌ‰ε…₯!請開始提問。"
52
 
53
  # 主程式 - Gradio 介青
54
  with gr.Blocks() as demo:
55
- gr.Markdown("## πŸ“˜ AI ζ–‡δ»ΆεŠ©η† - 支援 PDF 問答")
56
 
57
  with gr.Row():
58
  api_key = gr.Textbox(label="πŸ”‘ θ«‹θΌΈε…₯ζ‚¨ηš„ OpenAI API Key", type="password")
59
- pdf_file = gr.File(label="πŸ“‚ δΈŠε‚³ PDF ζ–‡δ»Ά", file_types=[".pdf"])
60
 
61
  chatbot = gr.Chatbot(label="πŸ’¬ θŠε€©ε€")
62
  state = gr.State([])
@@ -71,7 +71,7 @@ with gr.Blocks() as demo:
71
 
72
  def handle_user_input(api_key, user_message, chat_history):
73
  if not vectordb:
74
- return chat_history, "θ«‹ε…ˆδΈŠε‚³ PDF 文仢。"
75
  if user_message.strip().lower() == "謝謝":
76
  return chat_history, "加油~~~"
77
  return handle_query(api_key, user_message, vectordb, chat_history)
 
48
  vectordb = load_and_process_pdf(pdf_file, api_key)
49
  if isinstance(vectordb, str):
50
  return vectordb
51
+ return "ι£Ÿθ­œε·²ζˆεŠŸθΌ‰ε…₯οΌθ«‹ι–‹ε§‹ι»žθœγ€‚"
52
 
53
  # 主程式 - Gradio 介青
54
  with gr.Blocks() as demo:
55
+ gr.Markdown("## πŸ“˜ εœ‹ιš›ε€§ε»šζ•™δ½ εšθœ ")
56
 
57
  with gr.Row():
58
  api_key = gr.Textbox(label="πŸ”‘ θ«‹θΌΈε…₯ζ‚¨ηš„ OpenAI API Key", type="password")
59
+ pdf_file = gr.File(label="πŸ“‚ δΈŠε‚³ PDF 食譜", file_types=[".pdf"])
60
 
61
  chatbot = gr.Chatbot(label="πŸ’¬ θŠε€©ε€")
62
  state = gr.State([])
 
71
 
72
  def handle_user_input(api_key, user_message, chat_history):
73
  if not vectordb:
74
+ return chat_history, "θ«‹ε…ˆδΈŠε‚³ PDF ι£Ÿθ­œγ€‚"
75
  if user_message.strip().lower() == "謝謝":
76
  return chat_history, "加油~~~"
77
  return handle_query(api_key, user_message, vectordb, chat_history)