Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1239,63 +1239,63 @@ def create_jain_interface():
|
|
1239 |
"μ΄λͺ
κ³Ό μμ μμ§μ λν΄ μ΄λ»κ² μκ°νμΈμ?"
|
1240 |
]
|
1241 |
|
1242 |
-
|
1243 |
-
|
1244 |
|
1245 |
-
def submit_message(message, history):
|
1246 |
-
|
1247 |
-
|
1248 |
|
1249 |
-
def get_system_status():
|
1250 |
-
|
1251 |
|
1252 |
-
def clear_memory():
|
1253 |
-
|
1254 |
|
1255 |
-
with gr.Blocks() as interface:
|
1256 |
-
|
1257 |
-
|
1258 |
placeholder="λ©μμ§λ₯Ό μ
λ ₯νμΈμ...",
|
1259 |
lines=2,
|
1260 |
max_lines=10,
|
1261 |
elem_id="msg_input"
|
1262 |
)
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
)
|
1273 |
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
)
|
1279 |
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
)
|
1284 |
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
)
|
1289 |
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
)
|
1294 |
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
)
|
1300 |
|
1301 |
# JS μ€ν¬λ¦½νΈ μΆκ° (Enter=μ μ‘, Shift+Enter=μ€λ°κΏ)
|
|
|
1239 |
"μ΄λͺ
κ³Ό μμ μμ§μ λν΄ μ΄λ»κ² μκ°νμΈμ?"
|
1240 |
]
|
1241 |
|
1242 |
+
def set_example():
|
1243 |
+
return random.choice(example_messages)
|
1244 |
|
1245 |
+
def submit_message(message, history):
|
1246 |
+
"""λ©μμ§ μ μ‘ μ²λ¦¬"""
|
1247 |
+
return chat_function(message, history)
|
1248 |
|
1249 |
+
def get_system_status():
|
1250 |
+
return "μμ€ν
μ μ μλ μ€"
|
1251 |
|
1252 |
+
def clear_memory():
|
1253 |
+
return [], ""
|
1254 |
|
1255 |
+
with gr.Blocks() as interface:
|
1256 |
+
chatbot = gr.Chatbot()
|
1257 |
+
msg_input = gr.Textbox(
|
1258 |
placeholder="λ©μμ§λ₯Ό μ
λ ₯νμΈμ...",
|
1259 |
lines=2,
|
1260 |
max_lines=10,
|
1261 |
elem_id="msg_input"
|
1262 |
)
|
1263 |
+
send_btn = gr.Button("μ μ‘")
|
1264 |
+
refresh_btn = gr.Button("μλ‘κ³ μΉ¨")
|
1265 |
+
clear_btn = gr.Button("μ΄κΈ°ν")
|
1266 |
+
example_btn = gr.Button("μμ ")
|
1267 |
+
|
1268 |
+
send_btn.click(
|
1269 |
+
fn=submit_message,
|
1270 |
+
inputs=[msg_input, chatbot],
|
1271 |
+
outputs=[chatbot, msg_input]
|
1272 |
)
|
1273 |
|
1274 |
+
msg_input.submit(
|
1275 |
+
fn=submit_message,
|
1276 |
+
inputs=[msg_input, chatbot],
|
1277 |
+
outputs=[chatbot, msg_input]
|
1278 |
)
|
1279 |
|
1280 |
+
refresh_btn.click(
|
1281 |
+
fn=get_system_status,
|
1282 |
+
outputs=chatbot,
|
1283 |
)
|
1284 |
|
1285 |
+
clear_btn.click(
|
1286 |
+
fn=clear_memory,
|
1287 |
+
outputs=[chatbot, msg_input]
|
1288 |
)
|
1289 |
|
1290 |
+
example_btn.click(
|
1291 |
+
fn=set_example,
|
1292 |
+
outputs=msg_input,
|
1293 |
)
|
1294 |
|
1295 |
+
msg_input.submit(
|
1296 |
+
fn=submit_message,
|
1297 |
+
inputs=[msg_input, chatbot],
|
1298 |
+
outputs=[chatbot, msg_input]
|
1299 |
)
|
1300 |
|
1301 |
# JS μ€ν¬λ¦½νΈ μΆκ° (Enter=μ μ‘, Shift+Enter=μ€λ°κΏ)
|