Spaces:
Runtime error
Runtime error
Update web.py
Browse files
web.py
CHANGED
@@ -1,26 +1,16 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
|
4 |
-
def
|
5 |
# μ¬κΈ°μ μ±λ΄ λ‘μ§μ ꡬννμΈμ
|
6 |
return f"μμ½: {message}"
|
7 |
|
8 |
def run_gradio():
|
9 |
with gr.Blocks() as demo:
|
10 |
-
|
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,
|
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()
|