Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -45,12 +45,22 @@ def ask_question(file, question, history):
|
|
45 |
history.append((question, answer))
|
46 |
return "", history
|
47 |
|
48 |
-
with gr.Blocks() as demo:
|
49 |
-
gr.Markdown("##
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
state = gr.State([])
|
|
|
54 |
question.submit(ask_question, [file_input, question, state], [question, chatbot])
|
55 |
|
56 |
demo.launch()
|
|
|
45 |
history.append((question, answer))
|
46 |
return "", history
|
47 |
|
48 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
49 |
+
gr.Markdown("## 📄 Document QA with Smart Retrieval")
|
50 |
+
|
51 |
+
with gr.Group():
|
52 |
+
with gr.Box():
|
53 |
+
gr.Markdown("### 🔽 Upload Your File")
|
54 |
+
file_input = gr.File(
|
55 |
+
label="Choose a PDF or Word file",
|
56 |
+
file_types=[".pdf", ".docx"],
|
57 |
+
type="file"
|
58 |
+
)
|
59 |
+
|
60 |
+
chatbot = gr.Chatbot(label="💬 Chat with Document")
|
61 |
+
question = gr.Textbox(label="Ask your question", placeholder="Type your question here...")
|
62 |
state = gr.State([])
|
63 |
+
|
64 |
question.submit(ask_question, [file_input, question, state], [question, chatbot])
|
65 |
|
66 |
demo.launch()
|