Prompthumanizer commited on
Commit
a954bcb
Β·
verified Β·
1 Parent(s): 1c1ec8a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -38
app.py CHANGED
@@ -1239,63 +1239,63 @@ def create_jain_interface():
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=μ€„λ°”κΏˆ)
 
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=μ€„λ°”κΏˆ)