Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -104,28 +104,27 @@ def gen(input):
|
|
104 |
out = remove_caseifer(generated_text)
|
105 |
return input + out
|
106 |
|
107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
with gr.Blocks() as demo:
|
109 |
chatbot = gr.Chatbot()
|
110 |
msg = gr.Textbox()
|
111 |
clear = gr.Button("Clear")
|
112 |
|
113 |
-
def
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
history[-1][1] += character
|
121 |
-
time.sleep(0.05)
|
122 |
-
yield history
|
123 |
-
|
124 |
-
response = msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
125 |
-
bot, chatbot, chatbot
|
126 |
-
)
|
127 |
-
response.then(lambda: gr.update(interactive=True), None, [msg], queue=False)
|
128 |
clear.click(lambda: None, None, chatbot, queue=False)
|
129 |
|
130 |
-
demo.
|
131 |
-
demo.launch()
|
|
|
104 |
out = remove_caseifer(generated_text)
|
105 |
return input + out
|
106 |
|
107 |
+
md = """This is some code:
|
108 |
+
|
109 |
+
hello
|
110 |
+
|
111 |
+
```py
|
112 |
+
def fn(x, y, z):
|
113 |
+
print(x, y, z)
|
114 |
+
"""
|
115 |
+
|
116 |
with gr.Blocks() as demo:
|
117 |
chatbot = gr.Chatbot()
|
118 |
msg = gr.Textbox()
|
119 |
clear = gr.Button("Clear")
|
120 |
|
121 |
+
def respond(message, chat_history):
|
122 |
+
bot_message = random.choice(["How are you?", "I love you", "I'm very hungry"])
|
123 |
+
chat_history.append((message, md))
|
124 |
+
time.sleep(1)
|
125 |
+
return "", chat_history
|
126 |
+
|
127 |
+
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
clear.click(lambda: None, None, chatbot, queue=False)
|
129 |
|
130 |
+
demo.launch()
|
|