Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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(
|
20 |
-
doc = fitz.open(
|
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()
|