Spaces:
Sleeping
Sleeping
Commit Β·
04f3534
1
Parent(s): a8c0a8e
ui betterment
Browse files
app.py
CHANGED
|
@@ -98,40 +98,49 @@ def clear_state():
|
|
| 98 |
|
| 99 |
# UI Setup
|
| 100 |
with gr.Blocks(
|
| 101 |
-
theme=gr.themes.
|
| 102 |
-
primary_hue="
|
| 103 |
secondary_hue="blue",
|
| 104 |
-
font=[gr.themes.GoogleFont("
|
| 105 |
),
|
| 106 |
css="footer {visibility: hidden}",
|
| 107 |
) as demo:
|
| 108 |
-
gr.Markdown("#
|
|
|
|
| 109 |
with gr.Row():
|
| 110 |
-
with gr.Column(scale=1):
|
|
|
|
| 111 |
file_input = gr.File(
|
| 112 |
file_count="single", type="filepath", label="Upload Document"
|
| 113 |
)
|
|
|
|
| 114 |
with gr.Row():
|
| 115 |
-
btn = gr.Button("
|
| 116 |
-
clear = gr.Button("Clear")
|
| 117 |
-
|
| 118 |
with gr.Column(scale=3):
|
| 119 |
chatbot = gr.ChatInterface(
|
| 120 |
fn=respond,
|
| 121 |
-
chatbot=gr.Chatbot(
|
| 122 |
-
|
| 123 |
-
|
|
|
|
| 124 |
textbox=gr.Textbox(
|
| 125 |
-
placeholder="Ask questions about the
|
| 126 |
container=False,
|
|
|
|
| 127 |
),
|
|
|
|
|
|
|
| 128 |
)
|
| 129 |
|
| 130 |
# Set up Gradio interactions
|
| 131 |
btn.click(fn=load_files, inputs=file_input, outputs=output)
|
|
|
|
| 132 |
clear.click(
|
| 133 |
-
fn=clear_state, # Use the clear_state function
|
| 134 |
-
outputs=[file_input, output],
|
|
|
|
| 135 |
)
|
| 136 |
|
| 137 |
# Launch the demo - ONLY CHANGE THIS LINE
|
|
|
|
| 98 |
|
| 99 |
# UI Setup
|
| 100 |
with gr.Blocks(
|
| 101 |
+
theme=gr.themes.Monochrome(
|
| 102 |
+
primary_hue="indigo",
|
| 103 |
secondary_hue="blue",
|
| 104 |
+
font=[gr.themes.GoogleFont("Inter"), "system-ui", "sans-serif"],
|
| 105 |
),
|
| 106 |
css="footer {visibility: hidden}",
|
| 107 |
) as demo:
|
| 108 |
+
gr.Markdown("# Document Q&A π€π")
|
| 109 |
+
|
| 110 |
with gr.Row():
|
| 111 |
+
with gr.Column(scale=1, min_width=300):
|
| 112 |
+
gr.Markdown("### Controls")
|
| 113 |
file_input = gr.File(
|
| 114 |
file_count="single", type="filepath", label="Upload Document"
|
| 115 |
)
|
| 116 |
+
output = gr.Textbox(label="Status", interactive=False)
|
| 117 |
with gr.Row():
|
| 118 |
+
btn = gr.Button("1. Process Document", variant="primary", scale=2)
|
| 119 |
+
clear = gr.Button("Clear All", scale=1)
|
| 120 |
+
|
| 121 |
with gr.Column(scale=3):
|
| 122 |
chatbot = gr.ChatInterface(
|
| 123 |
fn=respond,
|
| 124 |
+
chatbot=gr.Chatbot(
|
| 125 |
+
height=500,
|
| 126 |
+
label="Chat Window",
|
| 127 |
+
),
|
| 128 |
textbox=gr.Textbox(
|
| 129 |
+
placeholder="2. Ask questions about the document here...",
|
| 130 |
container=False,
|
| 131 |
+
scale=7,
|
| 132 |
),
|
| 133 |
+
submit_btn="Ask",
|
| 134 |
+
show_progress="full",
|
| 135 |
)
|
| 136 |
|
| 137 |
# Set up Gradio interactions
|
| 138 |
btn.click(fn=load_files, inputs=file_input, outputs=output)
|
| 139 |
+
|
| 140 |
clear.click(
|
| 141 |
+
fn=clear_state, # Use the clear_state function
|
| 142 |
+
outputs=[file_input, output, chatbot],
|
| 143 |
+
queue=False
|
| 144 |
)
|
| 145 |
|
| 146 |
# Launch the demo - ONLY CHANGE THIS LINE
|