Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -151,32 +151,29 @@ def process_and_query(state, question):
|
|
151 |
|
152 |
# Define the Gradio interface
|
153 |
def main():
|
154 |
-
|
155 |
fn=upload_files,
|
156 |
-
inputs=gr.
|
157 |
-
outputs=gr.
|
158 |
live=True,
|
159 |
capture_session=True
|
160 |
)
|
161 |
|
162 |
-
|
163 |
fn=process_and_query,
|
164 |
-
inputs=gr.
|
165 |
-
outputs=gr.
|
166 |
live=True,
|
167 |
capture_session=True
|
168 |
)
|
169 |
|
170 |
-
gr.
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
live=True,
|
178 |
-
capture_session=True
|
179 |
-
).launch()
|
180 |
|
181 |
if __name__ == "__main__":
|
182 |
main()
|
|
|
151 |
|
152 |
# Define the Gradio interface
|
153 |
def main():
|
154 |
+
upload_interface = gr.Interface(
|
155 |
fn=upload_files,
|
156 |
+
inputs=gr.File(label="Upload PDF or DOCX files", multiple=True),
|
157 |
+
outputs=gr.Textbox(label="Upload Status"),
|
158 |
live=True,
|
159 |
capture_session=True
|
160 |
)
|
161 |
|
162 |
+
query_interface = gr.Interface(
|
163 |
fn=process_and_query,
|
164 |
+
inputs=[gr.State(), gr.Textbox(label="Enter your query")],
|
165 |
+
outputs=gr.Textbox(label="Query Response"),
|
166 |
live=True,
|
167 |
capture_session=True
|
168 |
)
|
169 |
|
170 |
+
with gr.Blocks() as demo:
|
171 |
+
with gr.Tab("Upload Files"):
|
172 |
+
upload_interface.render()
|
173 |
+
with gr.Tab("Query"):
|
174 |
+
query_interface.render()
|
175 |
+
|
176 |
+
demo.launch()
|
|
|
|
|
|
|
177 |
|
178 |
if __name__ == "__main__":
|
179 |
main()
|