Prompthumanizer commited on
Commit
c143618
ยท
verified ยท
1 Parent(s): 03fe7f0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -49
app.py CHANGED
@@ -1135,6 +1135,7 @@ def create_jain_interface():
1135
  """
1136
 
1137
  # Gradio ์ธํ„ฐํŽ˜์ด์Šค ๊ตฌ์„ฑ
 
1138
  with gr.Blocks(css=custom_css, title="์ œ์ธ ์•„ํ‚คํ…์ฒ˜ - ์™„์ „๊ฐ์„ฑ์ฒด", theme=gr.themes.Soft()) as interface:
1139
 
1140
  # ํ—ค๋” ์„น์…˜
@@ -1164,55 +1165,33 @@ def create_jain_interface():
1164
  clear_btn = gr.Button("๐Ÿ—‘๏ธ ๋Œ€ํ™” ์ดˆ๊ธฐํ™”", variant="secondary", size="sm")
1165
 
1166
  gr.HTML('</div>')
1167
-
1168
- # ์‚ฌ์šฉ ๊ฐ€์ด๋“œ
1169
- gr.HTML("""
1170
- <div class="status-panel" style="margin-top: 20px;">
1171
- <h3>๐Ÿ’ก ์‚ฌ์šฉ ๊ฐ€์ด๋“œ</h3>
1172
- <ul style="text-align: left; padding-left: 20px;">
1173
- <li><strong>์‚ฌ์ฃผ ์ƒ๋‹ด:</strong> "์‚ฌ์ฃผ๋ฅผ ๋ด์ฃผ์„ธ์š”" ๋˜๋Š” ๊ตฌ์ฒด์ ์ธ ๊ณ ๋ฏผ</li>
1174
- <li><strong>์ฒ ํ•™ ๋Œ€ํ™”:</strong> ์กด์žฌ, ์˜๋ฏธ, ์ง„๋ฆฌ์— ๋Œ€ํ•œ ์งˆ๋ฌธ</li>
1175
- <li><strong>์ง€ํ˜œ ์ƒ๋‹ด:</strong> ์ธ์ƒ์˜ ๊ณ ๋ฏผ์ด๋‚˜ ์–ด๋ ค์›€</li>
1176
- <li><strong>์ผ๋ฐ˜ ๋Œ€ํ™”:</strong> ํŽธ์•ˆํ•œ ์ผ์ƒ ์ด์•ผ๊ธฐ</li>
1177
- </ul>
1178
- <p><em>๐ŸŒŸ ์ œ์ธ์ด ๊นŠ์ด ์žˆ๊ณ  ์˜๋ฏธ ์žˆ๋Š” ๋Œ€ํ™”๋ฅผ ์ด๋Œ์–ด๊ฐ‘๋‹ˆ๋‹ค.</em></p>
1179
- </div>
1180
- """)
1181
-
1182
- # ์˜ค๋ฅธ์ชฝ: ๋ฉ”์ธ ์ฑ„ํŒ… ์˜์—ญ
1183
- with gr.Column(scale=2, min_width=600):
1184
- gr.HTML('<div class="chat-container">')
1185
-
1186
- with gr.Group():
1187
- gr.Markdown("## ๐Ÿ’ฌ ์ œ์ธ๊ณผ์˜ ๊นŠ์ด ์žˆ๋Š” ๋Œ€ํ™”")
1188
- gr.Markdown("*๊นจ์–ด๋‚œ AI์™€ ํ•จ๊ป˜ํ•˜๋Š” ์‚ฌ์ฃผ, ์ฒ ํ•™, ์ง€ํ˜œ์˜ ์—ฌ์ •*")
1189
-
1190
- chatbot = gr.Chatbot(
1191
- label="์ œ์ธ ์•„ํ‚คํ…์ฒ˜ ์ฑ„ํŒ…",
1192
- height=600,
1193
- show_label=False,
1194
- container=True,
1195
- bubble_full_width=False,
1196
- avatar_images=("๐Ÿง‘โ€๐Ÿ’ผ", "๐ŸŒŸ"),
1197
- show_copy_button=True,
1198
- )
1199
-
1200
- with gr.Row():
1201
- msg_input = gr.Textbox(
1202
- label="๋ฉ”์‹œ์ง€ ์ž…๋ ฅ",
1203
- placeholder="์ œ์ธ์—๊ฒŒ ๋ฌด์—‡์ด๋“  ๋ฌผ์–ด๋ณด์„ธ์š”... (์‚ฌ์ฃผ, ์ฒ ํ•™, ๊ณ ๋ฏผ, ์ผ์ƒ ๋“ฑ)\n\n๐Ÿ’ก ์˜ˆ์‹œ:\nโ€ข '์‚ฌ์ฃผ๋ฅผ ๋ด์ฃผ์„ธ์š”'\nโ€ข '์ธ์ƒ์˜ ์˜๋ฏธ๊ฐ€ ๋ญ˜๊นŒ์š”?'\nโ€ข '์š”์ฆ˜ ๊ณ ๋ฏผ์ด ์žˆ์–ด์„œ...'\nโ€ข '์•ˆ๋…•ํ•˜์„ธ์š”, ์ œ์ธ!'",
1204
- lines=4,
1205
- max_lines=10,
1206
- scale=4,
1207
- container=True,
1208
- interactive=True,
1209
- )
1210
-
1211
- with gr.Column(scale=1, min_width=100):
1212
- send_btn = gr.Button("๐Ÿ“ค ์ „์†ก", variant="primary", size="lg")
1213
- example_btn = gr.Button("๐Ÿ’ก ์˜ˆ์‹œ", variant="secondary", size="sm")
1214
-
1215
- gr.HTML('</div>')
1216
 
1217
  # ํ‘ธํ„ฐ
1218
  gr.HTML("""
 
1135
  """
1136
 
1137
  # Gradio ์ธํ„ฐํŽ˜์ด์Šค ๊ตฌ์„ฑ
1138
+ # Gradio ์ธํ„ฐํŽ˜์ด์Šค ๊ตฌ์„ฑ
1139
  with gr.Blocks(css=custom_css, title="์ œ์ธ ์•„ํ‚คํ…์ฒ˜ - ์™„์ „๊ฐ์„ฑ์ฒด", theme=gr.themes.Soft()) as interface:
1140
 
1141
  # ํ—ค๋” ์„น์…˜
 
1165
  clear_btn = gr.Button("๐Ÿ—‘๏ธ ๋Œ€ํ™” ์ดˆ๊ธฐํ™”", variant="secondary", size="sm")
1166
 
1167
  gr.HTML('</div>')
1168
+
1169
+ with gr.Row():
1170
+ # ์˜ค๋ฅธ์ชฝ: ์ฑ„ํŒ… ์ธํ„ฐํŽ˜์ด์Šค
1171
+ with gr.Column(scale=2):
1172
+ chatbot = gr.Chatbot(label="๐Ÿ’ฌ ์ œ์ธ๊ณผ์˜ ๋Œ€ํ™”", elem_id="chatbot")
1173
+ textbox = gr.Textbox(
1174
+ placeholder="๋ฉ”์‹œ์ง€๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”.",
1175
+ label="โœ๏ธ ์ž…๋ ฅ์ฐฝ",
1176
+ show_label=True
1177
+ )
1178
+ state = gr.State([])
1179
+
1180
+ textbox.submit(
1181
+ fn=chat_function,
1182
+ inputs=[textbox, state],
1183
+ outputs=[chatbot, textbox]
1184
+ )
1185
+
1186
+ clear_btn.click(
1187
+ fn=clear_memory,
1188
+ outputs=[chatbot, textbox]
1189
+ )
1190
+
1191
+ refresh_btn.click(
1192
+ fn=lambda: get_system_status(),
1193
+ outputs=[system_status]
1194
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1195
 
1196
  # ํ‘ธํ„ฐ
1197
  gr.HTML("""