Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -186,33 +186,16 @@ import gradio as gr
|
|
186 |
|
187 |
nickname = "์ฌ์ฉ์"
|
188 |
|
189 |
-
def
|
190 |
message = message.replace("@์ฌ์ฉ์1@", nickname)
|
191 |
-
|
192 |
-
bot_response = ""
|
193 |
for partial in generate_text_better_sampling(model, message):
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
chat_history = gr.State([])
|
204 |
-
|
205 |
-
txt_input = gr.TextArea(placeholder="๋ฉ์์ง๋ฅผ ์
๋ ฅํ์ธ์...", lines=2)
|
206 |
-
chat_display = gr.Markdown()
|
207 |
-
|
208 |
-
def update_display(history):
|
209 |
-
formatted = ""
|
210 |
-
for user_msg, bot_msg in history:
|
211 |
-
formatted += f"**์ฌ์ฉ์:** {user_msg}\n\n"
|
212 |
-
formatted += f"**๋ด:** {bot_msg}\n\n"
|
213 |
-
return formatted
|
214 |
-
|
215 |
-
txt_input.submit(respond_stream, inputs=[txt_input, chat_history], outputs=[chat_history], queue=True)\
|
216 |
-
.then(update_display, inputs=chat_history, outputs=chat_display)
|
217 |
-
|
218 |
-
demo.launch()
|
|
|
186 |
|
187 |
nickname = "์ฌ์ฉ์"
|
188 |
|
189 |
+
def respond(message, chat_history):
|
190 |
message = message.replace("@์ฌ์ฉ์1@", nickname)
|
191 |
+
response = ""
|
|
|
192 |
for partial in generate_text_better_sampling(model, message):
|
193 |
+
response = partial
|
194 |
+
yield response
|
195 |
+
|
196 |
+
chat = gr.ChatInterface(
|
197 |
+
fn=respond,
|
198 |
+
title="InteractGPT",
|
199 |
+
)
|
200 |
+
|
201 |
+
chat.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|