openfree commited on
Commit
b45e256
·
verified ·
1 Parent(s): 1fd4ab2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -3
app.py CHANGED
@@ -158,6 +158,8 @@ css = """
158
  footer {visibility: hidden}
159
  """
160
 
 
 
161
  with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css, title="EveryChat 🤖") as demo:
162
  gr.HTML(
163
  """
@@ -170,14 +172,20 @@ with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css, title="EveryChat
170
 
171
  with gr.Row():
172
  with gr.Column(scale=2):
173
- chatbot = gr.Chatbot(height=600, label="Chat Interface 💬")
 
 
 
 
174
  msg = gr.Textbox(
175
  label="Type your message",
176
  show_label=False,
177
  placeholder="Ask me anything about the uploaded file... 💭",
178
  container=False
179
  )
180
- clear = gr.ClearButton([msg, chatbot], label="Clear Chat 🗑️")
 
 
181
 
182
  with gr.Column(scale=1):
183
  model_name = gr.Radio(
@@ -212,6 +220,17 @@ with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css, title="EveryChat
212
  [msg]
213
  )
214
 
 
 
 
 
 
 
 
 
 
 
 
215
  # Auto-analysis on file upload
216
  file_upload.change(
217
  chat,
@@ -234,4 +253,4 @@ with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css, title="EveryChat
234
  )
235
 
236
  if __name__ == "__main__":
237
- demo.launch()
 
158
  footer {visibility: hidden}
159
  """
160
 
161
+ # ... (이전 코드 동일)
162
+
163
  with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css, title="EveryChat 🤖") as demo:
164
  gr.HTML(
165
  """
 
172
 
173
  with gr.Row():
174
  with gr.Column(scale=2):
175
+ chatbot = gr.Chatbot(
176
+ height=600,
177
+ label="Chat Interface 💬",
178
+ type="messages" # 경고 해결을 위해 type 지정
179
+ )
180
  msg = gr.Textbox(
181
  label="Type your message",
182
  show_label=False,
183
  placeholder="Ask me anything about the uploaded file... 💭",
184
  container=False
185
  )
186
+ with gr.Row():
187
+ clear = gr.ClearButton([msg, chatbot]) # label 제거
188
+ send = gr.Button("Send 📤")
189
 
190
  with gr.Column(scale=1):
191
  model_name = gr.Radio(
 
220
  [msg]
221
  )
222
 
223
+ send.click( # 전송 버튼 이벤트 추가
224
+ chat,
225
+ inputs=[msg, chatbot, file_upload, model_name, system_message, max_tokens, temperature, top_p],
226
+ outputs=[msg, chatbot],
227
+ queue=True
228
+ ).then(
229
+ lambda: gr.update(interactive=True),
230
+ None,
231
+ [msg]
232
+ )
233
+
234
  # Auto-analysis on file upload
235
  file_upload.change(
236
  chat,
 
253
  )
254
 
255
  if __name__ == "__main__":
256
+ demo.launch()