Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -47,16 +47,24 @@ def launch_web_script():
|
|
47 |
# web.py를 백그라운드에서 실행
|
48 |
subprocess.Popen(["python", "web.py"])
|
49 |
|
|
|
|
|
|
|
|
|
|
|
50 |
if __name__ == "__main__":
|
51 |
# web.py를 실행
|
52 |
launch_web_script()
|
53 |
|
54 |
# Gradio 인터페이스 설정
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
47 |
# web.py를 백그라운드에서 실행
|
48 |
subprocess.Popen(["python", "web.py"])
|
49 |
|
50 |
+
def chat_interface(user_input, chat_history):
|
51 |
+
response = generate_response(user_input)
|
52 |
+
chat_history.append((user_input, response))
|
53 |
+
return "", chat_history
|
54 |
+
|
55 |
if __name__ == "__main__":
|
56 |
# web.py를 실행
|
57 |
launch_web_script()
|
58 |
|
59 |
# Gradio 인터페이스 설정
|
60 |
+
with gr.Blocks() as demo:
|
61 |
+
gr.Markdown("## Chat with OpenAI")
|
62 |
+
chatbot = gr.Chatbot()
|
63 |
+
with gr.Row():
|
64 |
+
with gr.Column():
|
65 |
+
user_input = gr.Textbox(show_label=False, placeholder="Enter your message...")
|
66 |
+
submit_button = gr.Button("Send")
|
67 |
+
|
68 |
+
submit_button.click(chat_interface, [user_input, chatbot], [user_input, chatbot])
|
69 |
+
|
70 |
+
demo.launch(server_name="0.0.0.0", server_port=7861)
|