Update app.py
Browse files
app.py
CHANGED
@@ -94,28 +94,40 @@ def upload_pdf(file):
|
|
94 |
return f"An error occurred: {e}"
|
95 |
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
with gr.Blocks() as demo:
|
101 |
|
102 |
btn = gr.UploadButton("Upload a PDF", file_types=[".pdf"])
|
103 |
output = gr.Textbox(label="Output Box", style={"height": "100px", "margin-top": "20px"})
|
104 |
-
chatbot = gr.Chatbot(height=240
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
|
120 |
|
121 |
gr.close_all()
|
|
|
94 |
return f"An error occurred: {e}"
|
95 |
|
96 |
|
|
|
|
|
|
|
97 |
with gr.Blocks() as demo:
|
98 |
|
99 |
btn = gr.UploadButton("Upload a PDF", file_types=[".pdf"])
|
100 |
output = gr.Textbox(label="Output Box", style={"height": "100px", "margin-top": "20px"})
|
101 |
+
chatbot = gr.Chatbot(height=240)
|
102 |
+
|
103 |
+
with gr.Row():
|
104 |
+
with gr.Column(scale=0.70):
|
105 |
+
txt = gr.Textbox(
|
106 |
+
show_label=False,
|
107 |
+
placeholder="Enter a question",
|
108 |
+
)
|
109 |
+
|
110 |
+
|
111 |
+
|
112 |
+
# with gr.Blocks() as demo:
|
113 |
+
|
114 |
+
# btn = gr.UploadButton("Upload a PDF", file_types=[".pdf"])
|
115 |
+
# output = gr.Textbox(label="Output Box", style={"height": "100px", "margin-top": "20px"})
|
116 |
+
# chatbot = gr.Chatbot(height=240, placeholder="Ask me anything...", style={"margin-top": "20px"})
|
117 |
|
118 |
+
# with gr.Row(style={"margin-top": "20px"}):
|
119 |
+
# with gr.Column(scale=0.70):
|
120 |
+
# # Styled Textbox
|
121 |
+
# txt = gr.Textbox(
|
122 |
+
# show_label=False,
|
123 |
+
# placeholder="Enter a question",
|
124 |
+
# style={"width": "100%", "height": "100px", "margin-bottom": "10px"}
|
125 |
+
# )
|
126 |
|
127 |
|
128 |
+
# # Event handler for uploading a PDF
|
129 |
+
# btn.upload(fn=upload_pdf, inputs=[btn], outputs=[output])
|
130 |
+
# txt.submit(run_query, [btn, chatbot, txt], [chatbot, txt])
|
131 |
|
132 |
|
133 |
gr.close_all()
|