Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -233,6 +233,9 @@ def handle_url(url: str) -> tuple[str, str | None]:
|
|
| 233 |
return status, path
|
| 234 |
|
| 235 |
|
|
|
|
|
|
|
|
|
|
| 236 |
# -----------------------------
|
| 237 |
# Gradio App
|
| 238 |
# -----------------------------
|
|
@@ -249,18 +252,18 @@ This demo lets you **upload a PDF or load a sample**, then **search** for the mo
|
|
| 249 |
)
|
| 250 |
|
| 251 |
with gr.Row():
|
| 252 |
-
with gr.Column(scale=2):
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
|
| 265 |
with gr.Column(scale=3):
|
| 266 |
gr.Markdown("## 2️⃣ Search")
|
|
@@ -270,8 +273,8 @@ This demo lets you **upload a PDF or load a sample**, then **search** for the mo
|
|
| 270 |
output_text = gr.Textbox(label="AI Response", placeholder="Generated response based on retrieved documents")
|
| 271 |
|
| 272 |
# Wiring
|
| 273 |
-
index_btn.click(handle_upload, inputs=[pdf_input], outputs=[status_box, pdf_view])
|
| 274 |
-
index_url_btn.click(handle_url, inputs=[url_box], outputs=[status_box, pdf_view])
|
| 275 |
search_button.click(search, inputs=[query, k_slider], outputs=[output_text])
|
| 276 |
|
| 277 |
if __name__ == "__main__":
|
|
|
|
| 233 |
return status, path
|
| 234 |
|
| 235 |
|
| 236 |
+
print("Uploading")
|
| 237 |
+
print(handle_upload("https://sist.sathyabama.ac.in/sist_coursematerial/uploads/SAR1614.pdf"))
|
| 238 |
+
|
| 239 |
# -----------------------------
|
| 240 |
# Gradio App
|
| 241 |
# -----------------------------
|
|
|
|
| 252 |
)
|
| 253 |
|
| 254 |
with gr.Row():
|
| 255 |
+
# with gr.Column(scale=2):
|
| 256 |
+
# gr.Markdown("## 1️⃣ Load a PDF")
|
| 257 |
+
# pdf_input = gr.File(label="Upload PDF", file_types=[".pdf"])
|
| 258 |
+
# index_btn = gr.Button("📥 Index Uploaded PDF", variant="secondary")
|
| 259 |
+
# url_box = gr.Textbox(
|
| 260 |
+
# label="Or index from URL",
|
| 261 |
+
# placeholder="https://example.com/file.pdf",
|
| 262 |
+
# value="https://sist.sathyabama.ac.in/sist_coursematerial/uploads/SAR1614.pdf",
|
| 263 |
+
# )
|
| 264 |
+
# index_url_btn = gr.Button("🌐 Load Sample / From URL", variant="secondary")
|
| 265 |
+
# status_box = gr.Textbox(label="Status", interactive=False)
|
| 266 |
+
# pdf_view = PDF(label="PDF Preview")
|
| 267 |
|
| 268 |
with gr.Column(scale=3):
|
| 269 |
gr.Markdown("## 2️⃣ Search")
|
|
|
|
| 273 |
output_text = gr.Textbox(label="AI Response", placeholder="Generated response based on retrieved documents")
|
| 274 |
|
| 275 |
# Wiring
|
| 276 |
+
# index_btn.click(handle_upload, inputs=[pdf_input], outputs=[status_box, pdf_view])
|
| 277 |
+
# index_url_btn.click(handle_url, inputs=[url_box], outputs=[status_box, pdf_view])
|
| 278 |
search_button.click(search, inputs=[query, k_slider], outputs=[output_text])
|
| 279 |
|
| 280 |
if __name__ == "__main__":
|