3a05chatgpt commited on
Commit
2bf436a
Β·
verified Β·
1 Parent(s): f5680e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -16,8 +16,8 @@ def set_model(model_name):
16
  selected_model = model_name
17
  return f"βœ… ζ¨‘εž‹ε·²ιΈοΌš{model_name}"
18
 
19
- def extract_pdf_text(file_obj):
20
- doc = fitz.open(file_obj)
21
  text = ""
22
  for page in doc:
23
  text += page.get_text()
@@ -52,6 +52,7 @@ def ask_question(user_question):
52
 
53
  with gr.Blocks() as demo:
54
  gr.Markdown("# πŸ“„ PDF ζ‘˜θ¦ & ε•η­”εŠ©ζ‰‹ (Hugging Face η‰ˆ)")
 
55
  api_key_input = gr.Textbox(label="θΌΈε…₯ OpenAI API Key", type="password")
56
  api_key_status = gr.Textbox(label="η‹€ζ…‹", interactive=False)
57
  api_key_input.submit(set_api_key, inputs=api_key_input, outputs=api_key_status)
@@ -70,4 +71,4 @@ with gr.Blocks() as demo:
70
  question_btn = gr.Button("ι€ε‡Ίε•ι‘Œ")
71
  question_btn.click(ask_question, inputs=question_input, outputs=answer_output)
72
 
73
- demo.launch()
 
16
  selected_model = model_name
17
  return f"βœ… ζ¨‘εž‹ε·²ιΈοΌš{model_name}"
18
 
19
+ def extract_pdf_text(file_path):
20
+ doc = fitz.open(file_path)
21
  text = ""
22
  for page in doc:
23
  text += page.get_text()
 
52
 
53
  with gr.Blocks() as demo:
54
  gr.Markdown("# πŸ“„ PDF ζ‘˜θ¦ & ε•η­”εŠ©ζ‰‹ (Hugging Face η‰ˆ)")
55
+
56
  api_key_input = gr.Textbox(label="θΌΈε…₯ OpenAI API Key", type="password")
57
  api_key_status = gr.Textbox(label="η‹€ζ…‹", interactive=False)
58
  api_key_input.submit(set_api_key, inputs=api_key_input, outputs=api_key_status)
 
71
  question_btn = gr.Button("ι€ε‡Ίε•ι‘Œ")
72
  question_btn.click(ask_question, inputs=question_input, outputs=answer_output)
73
 
74
+ demo.launch()