Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -135,10 +135,6 @@ def update_image_display(image_url):
|
|
135 |
with gr.Blocks(theme=gr.themes.Soft()) as app:
|
136 |
gr.Markdown("# ๐ Document AI Assistant")
|
137 |
|
138 |
-
with gr.Row():
|
139 |
-
toggle_left = gr.Button("๐ Toggle Document Panel", elem_id="toggle-left")
|
140 |
-
toggle_right = gr.Button("๐๏ธ Toggle Voice Panel", elem_id="toggle-right")
|
141 |
-
|
142 |
chat_state = gr.State([])
|
143 |
thread_state = gr.State()
|
144 |
image_state = gr.State()
|
@@ -166,31 +162,22 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
166 |
voice_send_btn = gr.Button("๐ข Send Voice to Assistant")
|
167 |
clear_transcript_btn = gr.Button("๐งน Clear Transcript")
|
168 |
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
return (
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
)
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
inputs=[],
|
186 |
-
outputs=[left_col, center_col, right_col]
|
187 |
-
)
|
188 |
-
|
189 |
-
toggle_right.click(
|
190 |
-
fn=lambda: toggle_columns(left_col.visible, right_col.visible),
|
191 |
-
inputs=[],
|
192 |
-
outputs=[left_col, center_col, right_col]
|
193 |
-
)
|
194 |
|
195 |
send_btn.click(fn=handle_chat, inputs=[user_prompt, chat_state, thread_state, image_state],
|
196 |
outputs=[user_prompt, chat, thread_state, image_state])
|
@@ -203,4 +190,4 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
203 |
image_state.change(fn=update_image_display, inputs=image_state, outputs=image_display)
|
204 |
app.load(fn=create_ws, outputs=[client_id])
|
205 |
|
206 |
-
app.launch()
|
|
|
135 |
with gr.Blocks(theme=gr.themes.Soft()) as app:
|
136 |
gr.Markdown("# ๐ Document AI Assistant")
|
137 |
|
|
|
|
|
|
|
|
|
138 |
chat_state = gr.State([])
|
139 |
thread_state = gr.State()
|
140 |
image_state = gr.State()
|
|
|
162 |
voice_send_btn = gr.Button("๐ข Send Voice to Assistant")
|
163 |
clear_transcript_btn = gr.Button("๐งน Clear Transcript")
|
164 |
|
165 |
+
def toggle_left_panel():
|
166 |
+
new_vis = not left_col.visible
|
167 |
+
new_center_scale = 2 if new_vis and right_col.visible else (3 if new_vis or right_col.visible else 4)
|
168 |
+
return gr.update(visible=new_vis), gr.update(scale=new_center_scale)
|
169 |
+
|
170 |
+
def toggle_right_panel():
|
171 |
+
new_vis = not right_col.visible
|
172 |
+
new_center_scale = 2 if new_vis and left_col.visible else (3 if new_vis or left_col.visible else 4)
|
173 |
+
return gr.update(visible=new_vis), gr.update(scale=new_center_scale)
|
174 |
+
|
175 |
+
with gr.Row():
|
176 |
+
toggle_left_btn = gr.Button("๐ Toggle Document Panel")
|
177 |
+
toggle_right_btn = gr.Button("๐๏ธ Toggle Voice Panel")
|
178 |
+
|
179 |
+
toggle_left_btn.click(fn=toggle_left_panel, outputs=[left_col, center_col])
|
180 |
+
toggle_right_btn.click(fn=toggle_right_panel, outputs=[right_col, center_col])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
send_btn.click(fn=handle_chat, inputs=[user_prompt, chat_state, thread_state, image_state],
|
183 |
outputs=[user_prompt, chat, thread_state, image_state])
|
|
|
190 |
image_state.change(fn=update_image_display, inputs=image_state, outputs=image_display)
|
191 |
app.load(fn=create_ws, outputs=[client_id])
|
192 |
|
193 |
+
app.launch()
|