Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -181,37 +181,18 @@ def generate_text_better_sampling(model, prompt, max_len=100, max_gen=98, top_k=
|
|
181 |
|
182 |
yield decoded_text
|
183 |
|
|
|
184 |
|
185 |
-
|
186 |
-
|
187 |
-
nickname = "์ฌ์ฉ์1"
|
188 |
-
|
189 |
-
def respond(message, history):
|
190 |
message = message.replace("@์ฌ์ฉ์1@", nickname)
|
191 |
-
|
192 |
-
bot_response = ""
|
193 |
-
|
194 |
for partial in generate_text_better_sampling(model, message):
|
195 |
-
|
196 |
-
|
197 |
-
yield updated_history
|
198 |
-
|
199 |
-
with gr.Blocks() as demo:
|
200 |
-
state = gr.State([])
|
201 |
-
chat_display = gr.Markdown()
|
202 |
-
user_input = gr.Textbox(placeholder="๋ฉ์์ง๋ฅผ ์
๋ ฅํ์ธ์...", show_label=False)
|
203 |
-
|
204 |
-
def format_history(history):
|
205 |
-
return "\n\n".join([f"**{who}**: {what}" for who, what in history])
|
206 |
-
|
207 |
-
def update(history):
|
208 |
-
return format_history(history), history
|
209 |
-
|
210 |
-
def stream_response(message, history):
|
211 |
-
for updated_history in respond(message, history):
|
212 |
-
yield format_history(updated_history), updated_history
|
213 |
|
214 |
-
|
215 |
-
|
|
|
|
|
216 |
|
217 |
-
|
|
|
181 |
|
182 |
yield decoded_text
|
183 |
|
184 |
+
nickname = "์ฌ์ฉ์"
|
185 |
|
186 |
+
def respond(message, chat_history):
|
|
|
|
|
|
|
|
|
187 |
message = message.replace("@์ฌ์ฉ์1@", nickname)
|
188 |
+
response = ""
|
|
|
|
|
189 |
for partial in generate_text_better_sampling(model, message):
|
190 |
+
response = partial
|
191 |
+
yield response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
|
193 |
+
chat = gr.ChatInterface(
|
194 |
+
fn=respond,
|
195 |
+
title="InteractGPT",
|
196 |
+
)
|
197 |
|
198 |
+
chat.launch()
|