Spaces:
Runtime error
Runtime error
Update gradio_app.py
Browse files- gradio_app.py +19 -12
gradio_app.py
CHANGED
@@ -88,16 +88,23 @@ def chat_function(message, history):
|
|
88 |
history.append((message, response))
|
89 |
return history
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
-
|
|
|
|
88 |
history.append((message, response))
|
89 |
return history
|
90 |
|
91 |
+
with gr.Blocks() as demo:
|
92 |
+
gr.Markdown("# (PDF) Information and Inference🗞️")
|
93 |
+
gr.Markdown("Retrieval-Augmented Generation")
|
94 |
+
|
95 |
+
with gr.Row():
|
96 |
+
with gr.Column(scale=1):
|
97 |
+
file_output = gr.Textbox(label="Upload Status")
|
98 |
+
upload_button = gr.UploadButton("Upload PDF", file_types=[".pdf"])
|
99 |
+
|
100 |
+
with gr.Column(scale=2):
|
101 |
+
chatbot = gr.Chatbot()
|
102 |
+
msg = gr.Textbox(label="Ask me anything about the content of the PDF:")
|
103 |
+
clear = gr.Button("Clear")
|
104 |
+
|
105 |
+
upload_button.upload(process_file, upload_button, file_output)
|
106 |
+
msg.submit(chat_function, [msg, chatbot], chatbot)
|
107 |
+
clear.click(lambda: None, None, chatbot, queue=False)
|
108 |
|
109 |
+
if __name__ == "__main__":
|
110 |
+
demo.launch()
|