Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -45,11 +45,12 @@ def ask_question(file, question, history):
|
|
45 |
history.append((question, answer))
|
46 |
return "", history
|
47 |
|
48 |
-
with gr.Blocks(
|
49 |
gr.Markdown("## π Document QA with Smart Retrieval")
|
50 |
|
51 |
-
|
52 |
-
|
|
|
53 |
gr.Markdown("### π½ Upload Your File")
|
54 |
file_input = gr.File(
|
55 |
label="Choose a PDF or Word file",
|
@@ -58,9 +59,13 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
58 |
)
|
59 |
|
60 |
chatbot = gr.Chatbot(label="π¬ Chat with Document")
|
61 |
-
question = gr.Textbox(
|
|
|
|
|
|
|
62 |
state = gr.State([])
|
63 |
|
|
|
64 |
question.submit(ask_question, [file_input, question, state], [question, chatbot])
|
65 |
|
66 |
demo.launch()
|
|
|
45 |
history.append((question, answer))
|
46 |
return "", history
|
47 |
|
48 |
+
with gr.Blocks() as demo:
|
49 |
gr.Markdown("## π Document QA with Smart Retrieval")
|
50 |
|
51 |
+
# File upload styled like a dialogue box
|
52 |
+
with gr.Row():
|
53 |
+
with gr.Column():
|
54 |
gr.Markdown("### π½ Upload Your File")
|
55 |
file_input = gr.File(
|
56 |
label="Choose a PDF or Word file",
|
|
|
59 |
)
|
60 |
|
61 |
chatbot = gr.Chatbot(label="π¬ Chat with Document")
|
62 |
+
question = gr.Textbox(
|
63 |
+
label="Ask your question",
|
64 |
+
placeholder="Type your question here..."
|
65 |
+
)
|
66 |
state = gr.State([])
|
67 |
|
68 |
+
# Submit by pressing Enter
|
69 |
question.submit(ask_question, [file_input, question, state], [question, chatbot])
|
70 |
|
71 |
demo.launch()
|