Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -63,42 +63,42 @@ def generate_response(history, query):
|
|
63 |
history[-1][-1] += char
|
64 |
yield history, ''
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
with gr.Row():
|
74 |
-
chatbot = gr.Chatbot(value=[], elem_id='chatbot')
|
75 |
-
# chatbot = gr.Chatbot(value=[], elem_id='chatbot').style(height=570)
|
76 |
-
|
77 |
with gr.Row():
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
104 |
|
|
|
63 |
history[-1][-1] += char
|
64 |
yield history, ''
|
65 |
|
66 |
+
with gr.Blocks() as demo:
|
67 |
+
# Create a Gradio block
|
68 |
+
|
69 |
+
with gr.Column():
|
70 |
+
|
71 |
+
|
|
|
|
|
|
|
|
|
|
|
72 |
with gr.Row():
|
73 |
+
chatbot = gr.Chatbot(value=[], elem_id='chatbot')
|
74 |
+
# chatbot = gr.Chatbot(value=[], elem_id='chatbot').style(height=570)
|
75 |
+
|
76 |
+
with gr.Row():
|
77 |
+
with gr.Column(scale=2):
|
78 |
+
txt = gr.Textbox(
|
79 |
+
show_label=False,
|
80 |
+
placeholder="Enter text and press enter"
|
81 |
+
)
|
82 |
+
# ).style(container=False)
|
83 |
+
|
84 |
+
with gr.Column(scale=1):
|
85 |
+
submit_btn = gr.Button('Submit')
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
# Event handler for submitting text and generating response
|
90 |
+
submit_btn.click(
|
91 |
+
fn=add_text,
|
92 |
+
inputs=[chatbot, txt],
|
93 |
+
outputs=[chatbot],
|
94 |
+
queue=False
|
95 |
+
).success(
|
96 |
+
fn=generate_response,
|
97 |
+
inputs=[chatbot, txt],
|
98 |
+
outputs=[chatbot, txt]
|
99 |
+
)
|
100 |
+
|
101 |
+
if __name__ == "__main__":
|
102 |
+
demo.queue()
|
103 |
+
demo.launch()
|
104 |
|