Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -128,14 +128,21 @@ def process_and_query(state, question):
|
|
128 |
return {"message": generated_text, "conversation": state}
|
129 |
|
130 |
return {"error": "No question provided"}
|
131 |
-
|
132 |
# Create Gradio interface
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
)
|
140 |
-
|
141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
return {"message": generated_text, "conversation": state}
|
129 |
|
130 |
return {"error": "No question provided"}
|
131 |
+
|
132 |
# Create Gradio interface
|
133 |
+
with gr.Blocks() as demo:
|
134 |
+
gr.Markdown("## Document Upload and Query System")
|
135 |
+
|
136 |
+
with gr.Tab("Upload Files"):
|
137 |
+
upload = gr.File(file_count="multiple", label="Upload PDF or DOCX files")
|
138 |
+
upload_button = gr.Button("Upload")
|
139 |
+
upload_output = gr.Textbox()
|
140 |
+
upload_button.click(fn=upload_files, inputs=upload, outputs=upload_output)
|
141 |
+
|
142 |
+
with gr.Tab("Query"):
|
143 |
+
query = gr.Textbox(label="Enter your query")
|
144 |
+
query_button = gr.Button("Search")
|
145 |
+
query_output = gr.Textbox()
|
146 |
+
query_button.click(fn=query_text, inputs=query, outputs=query_output)
|
147 |
+
|
148 |
+
demo.launch()
|