Spaces:
Runtime error
Runtime error
Commit ·
71de0be
1
Parent(s): 8917285
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,7 +19,7 @@ class GUI:
|
|
| 19 |
return self.session.question(question)
|
| 20 |
|
| 21 |
|
| 22 |
-
|
| 23 |
with open("./logo.png", "rb") as f:
|
| 24 |
image_data = f.read()
|
| 25 |
image_base64 = base64.b64encode(image_data).decode("utf-8")
|
|
@@ -65,8 +65,17 @@ with gr.Blocks() as demo:
|
|
| 65 |
|
| 66 |
|
| 67 |
app = GUI()
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
return self.session.question(question)
|
| 20 |
|
| 21 |
|
| 22 |
+
|
| 23 |
with open("./logo.png", "rb") as f:
|
| 24 |
image_data = f.read()
|
| 25 |
image_base64 = base64.b64encode(image_data).decode("utf-8")
|
|
|
|
| 65 |
|
| 66 |
|
| 67 |
app = GUI()
|
| 68 |
+
def start_analyse(api_key, pdf_file):
|
| 69 |
+
return app.analyse(api_key, pdf_file)
|
| 70 |
+
|
| 71 |
+
def start_ask(question):
|
| 72 |
+
return app.ask_question(question)
|
| 73 |
+
|
| 74 |
+
iface = gr.Interface(fn=start_analyse,inputs=["text", "file"],outputs="text",title=title,description=description)
|
| 75 |
+
upload_button = iface.get_widget("file")
|
| 76 |
+
upload_button.label = "Upload PDF File"
|
| 77 |
+
question_input = gr.inputs.Textbox(label="Your Question", placeholder="Authors of this paper?")
|
| 78 |
+
ask_button = gr.Button("Ask")
|
| 79 |
+
iface.add_input(question_input)
|
| 80 |
+
iface.add_output(ask_button)
|
| 81 |
+
iface.launch()
|