Spaces:
Runtime error
Runtime error
TA
commited on
Commit
•
ff5d575
1
Parent(s):
0229f11
Update app.py
Browse files
app.py
CHANGED
@@ -24,7 +24,8 @@ def post_request_beta(payload):
|
|
24 |
response.raise_for_status()
|
25 |
return response.json()
|
26 |
|
27 |
-
def predict_beta(message, chatbot=
|
|
|
28 |
input_prompt = build_input_prompt(message, chatbot, system_prompt)
|
29 |
data = {"inputs": input_prompt}
|
30 |
try:
|
@@ -45,10 +46,12 @@ def predict_beta(message, chatbot=[], system_prompt=""):
|
|
45 |
error_msg = f"Failed to decode response as JSON: {str(e)}"
|
46 |
raise gr.Error(error_msg)
|
47 |
|
48 |
-
def test_preview_chatbot(message, history):
|
|
|
49 |
response = predict_beta(message, history, SYSTEM_PROMPT)
|
50 |
return response, EXAMPLE_IMAGE_URL
|
51 |
|
|
|
52 |
# Launch the interface
|
53 |
gr.Interface(
|
54 |
fn=test_preview_chatbot,
|
|
|
24 |
response.raise_for_status()
|
25 |
return response.json()
|
26 |
|
27 |
+
def predict_beta(message, chatbot=None, system_prompt=""):
|
28 |
+
chatbot = [] if chatbot is None else chatbot # Ensure chatbot is not None
|
29 |
input_prompt = build_input_prompt(message, chatbot, system_prompt)
|
30 |
data = {"inputs": input_prompt}
|
31 |
try:
|
|
|
46 |
error_msg = f"Failed to decode response as JSON: {str(e)}"
|
47 |
raise gr.Error(error_msg)
|
48 |
|
49 |
+
def test_preview_chatbot(message, history=None):
|
50 |
+
history = [] if history is None else history # Ensure history is not None
|
51 |
response = predict_beta(message, history, SYSTEM_PROMPT)
|
52 |
return response, EXAMPLE_IMAGE_URL
|
53 |
|
54 |
+
|
55 |
# Launch the interface
|
56 |
gr.Interface(
|
57 |
fn=test_preview_chatbot,
|