seawolf2357 commited on
Commit
702e906
Β·
verified Β·
1 Parent(s): 5535f24

Update web.py

Browse files
Files changed (1) hide show
  1. web.py +3 -13
web.py CHANGED
@@ -1,26 +1,16 @@
1
  import gradio as gr
2
  import os
3
 
4
- def chatbot(message):
5
  # 여기에 챗봇 λ‘œμ§μ„ κ΅¬ν˜„ν•˜μ„Έμš”
6
  return f"에코: {message}"
7
 
8
  def run_gradio():
9
  with gr.Blocks() as demo:
10
- chatbot = gr.Chatbot()
11
- msg = gr.Textbox()
12
- clear = gr.Button("Clear")
13
-
14
- def respond(message, chat_history):
15
- bot_message = chatbot(message)
16
- chat_history.append((message, bot_message))
17
- return "", chat_history
18
-
19
- msg.submit(respond, [msg, chatbot], [msg, chatbot])
20
- clear.click(lambda: None, None, chatbot, queue=False)
21
 
22
  port = int(os.getenv('GRADIO_SERVER_PORT', 7860))
23
- demo.launch(server_name="0.0.0.0", server_port=port, inbrowser=True)
24
 
25
  if __name__ == "__main__":
26
  run_gradio()
 
1
  import gradio as gr
2
  import os
3
 
4
+ def chatbot_response(message):
5
  # 여기에 챗봇 λ‘œμ§μ„ κ΅¬ν˜„ν•˜μ„Έμš”
6
  return f"에코: {message}"
7
 
8
  def run_gradio():
9
  with gr.Blocks() as demo:
10
+ chat_interface = gr.ChatInterface(chatbot_response)
 
 
 
 
 
 
 
 
 
 
11
 
12
  port = int(os.getenv('GRADIO_SERVER_PORT', 7860))
13
+ demo.launch(server_name="0.0.0.0", server_port=port, share=True)
14
 
15
  if __name__ == "__main__":
16
  run_gradio()