Spaces:
Runtime error
Runtime error
ai: Redesign input layout.
Browse files
app.py
CHANGED
|
@@ -207,7 +207,7 @@ def change_model(new_model_display):
|
|
| 207 |
return [], new_model_display
|
| 208 |
|
| 209 |
def check_send_button_enabled(msg, file):
|
| 210 |
-
return gr.update(
|
| 211 |
|
| 212 |
with gr.Blocks(fill_height=True, fill_width=True, title=AI_TYPES["AI_TYPE_4"], head=META_TAGS) as demo:
|
| 213 |
user_history = gr.State([])
|
|
@@ -215,14 +215,12 @@ with gr.Blocks(fill_height=True, fill_width=True, title=AI_TYPES["AI_TYPE_4"], h
|
|
| 215 |
|
| 216 |
chatbot = gr.Chatbot(label=AI_TYPES["AI_TYPE_1"], show_copy_button=True, show_share_button=False, scale=1, elem_id=AI_TYPES["AI_TYPE_2"])
|
| 217 |
model_dropdown = gr.Dropdown(label=AI_TYPES["AI_TYPE_3"], show_label=False, choices=MODEL_CHOICES, value=MODEL_CHOICES[0], interactive=True)
|
| 218 |
-
msg = gr.Textbox(label=RESPONSES["RESPONSE_4"], show_label=False,
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
send_btn = gr.Button(RESPONSES["RESPONSE_6"], visible=True, interactive=False)
|
| 222 |
-
stop_btn = gr.Button(RESPONSES["RESPONSE_7"], variant=RESPONSES["RESPONSE_9"], visible=False)
|
| 223 |
|
| 224 |
with gr.Accordion("See more...", open=False):
|
| 225 |
-
file_upload = gr.File(label=AI_TYPES["AI_TYPE_5"], file_count="single", type="filepath")
|
| 226 |
|
| 227 |
model_dropdown.change(fn=change_model, inputs=[model_dropdown], outputs=[user_history, selected_model])
|
| 228 |
send_btn.click(respond, inputs=[msg, file_upload, user_history, selected_model], outputs=[chatbot, msg, send_btn, stop_btn])
|
|
|
|
| 207 |
return [], new_model_display
|
| 208 |
|
| 209 |
def check_send_button_enabled(msg, file):
|
| 210 |
+
return gr.update(interactive=bool(msg.strip()) or bool(file))
|
| 211 |
|
| 212 |
with gr.Blocks(fill_height=True, fill_width=True, title=AI_TYPES["AI_TYPE_4"], head=META_TAGS) as demo:
|
| 213 |
user_history = gr.State([])
|
|
|
|
| 215 |
|
| 216 |
chatbot = gr.Chatbot(label=AI_TYPES["AI_TYPE_1"], show_copy_button=True, show_share_button=False, scale=1, elem_id=AI_TYPES["AI_TYPE_2"])
|
| 217 |
model_dropdown = gr.Dropdown(label=AI_TYPES["AI_TYPE_3"], show_label=False, choices=MODEL_CHOICES, value=MODEL_CHOICES[0], interactive=True)
|
| 218 |
+
msg = gr.Textbox(label=RESPONSES["RESPONSE_4"], show_label=False, placeholder=RESPONSES["RESPONSE_5"])
|
| 219 |
+
send_btn = gr.Button(RESPONSES["RESPONSE_6"], visible=True, interactive=False)
|
| 220 |
+
stop_btn = gr.Button(RESPONSES["RESPONSE_7"], variant=RESPONSES["RESPONSE_9"], visible=False)
|
|
|
|
|
|
|
| 221 |
|
| 222 |
with gr.Accordion("See more...", open=False):
|
| 223 |
+
file_upload = gr.File(label=AI_TYPES["AI_TYPE_5"], height=100, file_count="single", type="filepath")
|
| 224 |
|
| 225 |
model_dropdown.change(fn=change_model, inputs=[model_dropdown], outputs=[user_history, selected_model])
|
| 226 |
send_btn.click(respond, inputs=[msg, file_upload, user_history, selected_model], outputs=[chatbot, msg, send_btn, stop_btn])
|