Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -200,35 +200,22 @@ def generate_text_topkp_stream(model, prompt, max_len=100, max_gen=98, p=0.9, k=
|
|
200 |
|
201 |
yield decoded_text
|
202 |
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
with gr.Row():
|
221 |
-
with gr.Column(scale=1):
|
222 |
-
chatbot = gr.Chatbot(label="KeraLux", type="messages") # ์ด๊ฑฐ ๊ผญ ๋ช
์
|
223 |
-
with gr.Column(scale=0):
|
224 |
-
msg = gr.Textbox(
|
225 |
-
label="๋น์ ์ ์ง๋ฌธ์ ์
๋ ฅํ์ธ์!",
|
226 |
-
placeholder="ex) ๋ ์ข ๋์์ค ์ ์๋?",
|
227 |
-
lines=1,
|
228 |
-
)
|
229 |
-
state = gr.State([])
|
230 |
-
|
231 |
-
msg.submit(chat, inputs=[msg, state], outputs=[chatbot, state])
|
232 |
-
msg.submit(lambda: "", None, msg) # ์
๋ ฅ์ฐฝ ์ด๊ธฐํ
|
233 |
|
234 |
demo.launch(share=True)
|
|
|
200 |
|
201 |
yield decoded_text
|
202 |
|
203 |
+
|
204 |
+
history = ""
|
205 |
+
|
206 |
+
def chat(user_input):
|
207 |
+
global history
|
208 |
+
response = generate_text(user_input) # ๋ค ๋ชจ๋ธ ์์ฑ ํจ์
|
209 |
+
history += f"์ฌ์ฉ์: {user_input}\nKeraLux: {response}\n\n"
|
210 |
+
return history
|
211 |
+
|
212 |
+
with gr.Blocks() as demo:
|
213 |
+
gr.Markdown("### ๐ KeraLux Textbot\n๊ฐ๋จํ๊ณ ๋น ๋ฅธ ๋ํ์ฉ ๋ด์ด์์.\n")
|
214 |
+
|
215 |
+
textbox = gr.Textbox(placeholder="๋ฉ์์ง๋ฅผ ์
๋ ฅํ์ธ์", lines=1)
|
216 |
+
output_area = gr.Textbox(label="๋ํ ๊ธฐ๋ก", lines=20, interactive=False)
|
217 |
+
|
218 |
+
textbox.submit(chat, inputs=textbox, outputs=output_area)
|
219 |
+
textbox.submit(lambda: "", None, textbox) # ์
๋ ฅ์ฐฝ ์ด๊ธฐํ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
|
221 |
demo.launch(share=True)
|