Spaces:
Runtime error
Runtime error
Eric Michael Martinez
commited on
Commit
·
bd0ba0a
1
Parent(s):
d853fc3
update
Browse files
app.py
CHANGED
@@ -46,7 +46,7 @@ def chat(model, system_message, message, chatbot_messages, history_state):
|
|
46 |
return None, chatbot_messages, history_state
|
47 |
|
48 |
# Define a function to launch the chatbot interface using Gradio
|
49 |
-
def
|
50 |
# Load chatbot examples and merge with any additional examples provided
|
51 |
examples = chatbot_examples.load_examples(additional=additional_examples)
|
52 |
|
@@ -61,7 +61,7 @@ def launch_chatbot(additional_examples=[], share=False):
|
|
61 |
return system_message, user_message, [], []
|
62 |
|
63 |
# Create the Gradio interface using the Blocks layout
|
64 |
-
with gr.Blocks() as
|
65 |
with gr.Tab("Conversation"):
|
66 |
with gr.Row():
|
67 |
with gr.Column():
|
@@ -92,8 +92,8 @@ def launch_chatbot(additional_examples=[], share=False):
|
|
92 |
# Connect the send button to the chat function
|
93 |
btn.click(chat, inputs=[model_selector, system_message, message, chatbot, history_state], outputs=[message, chatbot, history_state])
|
94 |
# Launch the Gradio interface
|
95 |
-
|
96 |
|
97 |
# Call the launch_chatbot function to start the chatbot interface using Gradio
|
98 |
# Set the share parameter to False, meaning the interface will not be publicly accessible
|
99 |
-
|
|
|
46 |
return None, chatbot_messages, history_state
|
47 |
|
48 |
# Define a function to launch the chatbot interface using Gradio
|
49 |
+
def get_chatbot_app(additional_examples=[]):
|
50 |
# Load chatbot examples and merge with any additional examples provided
|
51 |
examples = chatbot_examples.load_examples(additional=additional_examples)
|
52 |
|
|
|
61 |
return system_message, user_message, [], []
|
62 |
|
63 |
# Create the Gradio interface using the Blocks layout
|
64 |
+
with gr.Blocks() as app:
|
65 |
with gr.Tab("Conversation"):
|
66 |
with gr.Row():
|
67 |
with gr.Column():
|
|
|
92 |
# Connect the send button to the chat function
|
93 |
btn.click(chat, inputs=[model_selector, system_message, message, chatbot, history_state], outputs=[message, chatbot, history_state])
|
94 |
# Launch the Gradio interface
|
95 |
+
return app
|
96 |
|
97 |
# Call the launch_chatbot function to start the chatbot interface using Gradio
|
98 |
# Set the share parameter to False, meaning the interface will not be publicly accessible
|
99 |
+
get_chatbot_app().launch()
|