Spaces:
Runtime error
Runtime error
Commit ·
edb2a81
1
Parent(s): 40042ef
added avatars
Browse files
app.py
CHANGED
|
@@ -260,15 +260,21 @@ css = """
|
|
| 260 |
|
| 261 |
# Define the Gradio interface
|
| 262 |
with gr.Blocks(css=css) as interface:
|
|
|
|
| 263 |
with gr.Row():
|
| 264 |
avatar = gr.Image(value="assets/rena2.png", label="Rena", interactive=False, show_label=False, elem_id="rena_avatar")
|
|
|
|
|
|
|
| 265 |
with gr.Row():
|
| 266 |
-
user_input = gr.Textbox(label="Your Message", lines=2, interactive=True
|
| 267 |
rena_response = gr.Textbox(label="Rena's Response", lines=10, interactive=False)
|
|
|
|
|
|
|
| 268 |
user_input.submit(chat, inputs=[user_input], outputs=[rena_response, avatar])
|
|
|
|
|
|
|
| 269 |
submit_button = gr.Button("Submit")
|
| 270 |
submit_button.click(chat, inputs=[user_input], outputs=[rena_response, avatar])
|
| 271 |
|
| 272 |
-
|
| 273 |
# Launch the app
|
| 274 |
interface.launch()
|
|
|
|
| 260 |
|
| 261 |
# Define the Gradio interface
|
| 262 |
with gr.Blocks(css=css) as interface:
|
| 263 |
+
# Avatar image
|
| 264 |
with gr.Row():
|
| 265 |
avatar = gr.Image(value="assets/rena2.png", label="Rena", interactive=False, show_label=False, elem_id="rena_avatar")
|
| 266 |
+
|
| 267 |
+
# User input and response
|
| 268 |
with gr.Row():
|
| 269 |
+
user_input = gr.Textbox(label="Your Message", lines=2, interactive=True)
|
| 270 |
rena_response = gr.Textbox(label="Rena's Response", lines=10, interactive=False)
|
| 271 |
+
|
| 272 |
+
# Add event to handle `Enter` key press
|
| 273 |
user_input.submit(chat, inputs=[user_input], outputs=[rena_response, avatar])
|
| 274 |
+
|
| 275 |
+
# Submit button (optional)
|
| 276 |
submit_button = gr.Button("Submit")
|
| 277 |
submit_button.click(chat, inputs=[user_input], outputs=[rena_response, avatar])
|
| 278 |
|
|
|
|
| 279 |
# Launch the app
|
| 280 |
interface.launch()
|