Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -200,6 +200,8 @@ def generate_text_topkp_stream(model, prompt, max_len=100, max_gen=98, p=0.9, k=
|
|
200 |
|
201 |
yield decoded_text
|
202 |
|
|
|
|
|
203 |
def chat(user_input, history):
|
204 |
if history is None:
|
205 |
history = []
|
@@ -207,16 +209,16 @@ def chat(user_input, history):
|
|
207 |
for partial_response in generate_text_topkp_stream(model, user_input, p=0.9):
|
208 |
yield history + [(user_input, partial_response)], history + [(user_input, partial_response)]
|
209 |
|
210 |
-
with gr.Blocks(
|
211 |
-
gr.Markdown(
|
212 |
-
"""
|
213 |
-
# 💡 KeraLux와 대화해보세요!
|
214 |
-
대화를 입력하면 KeraLux가 똑똑하게 대답해줄 거예요.
|
215 |
-
""",
|
216 |
-
elem_id="title",
|
217 |
-
)
|
218 |
-
gr.Markdown("---")
|
219 |
-
|
220 |
with gr.Row():
|
221 |
with gr.Column(scale=1):
|
222 |
chatbot = gr.Chatbot(label="KeraLux 채팅창", bubble_full_width=False)
|
@@ -227,8 +229,8 @@ with gr.Blocks(title="KeraLux Chat") as demo:
|
|
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 |
+
|
205 |
def chat(user_input, history):
|
206 |
if history is None:
|
207 |
history = []
|
|
|
209 |
for partial_response in generate_text_topkp_stream(model, user_input, p=0.9):
|
210 |
yield history + [(user_input, partial_response)], history + [(user_input, partial_response)]
|
211 |
|
212 |
+
with gr.Blocks() as demo: # title 제거됨
|
213 |
+
gr.Markdown(
|
214 |
+
"""
|
215 |
+
# 💡 KeraLux와 대화해보세요!
|
216 |
+
대화를 입력하면 KeraLux가 똑똑하게 대답해줄 거예요.
|
217 |
+
""",
|
218 |
+
elem_id="title",
|
219 |
+
)
|
220 |
+
gr.Markdown("---")
|
221 |
+
|
222 |
with gr.Row():
|
223 |
with gr.Column(scale=1):
|
224 |
chatbot = gr.Chatbot(label="KeraLux 채팅창", bubble_full_width=False)
|
|
|
229 |
lines=1,
|
230 |
)
|
231 |
state = gr.State([])
|
232 |
+
|
233 |
msg.submit(chat, inputs=[msg, state], outputs=[chatbot, state])
|
234 |
msg.submit(lambda: "", None, msg) # 입력창 초기화
|
235 |
+
|
236 |
+
demo.launch(share=True)
|