Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,13 +43,15 @@ with gr.Blocks() as demo:
|
|
| 43 |
return "", history + [[user_message, None]] # Add user message to chat history
|
| 44 |
|
| 45 |
def bot(history):
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
|
|
|
|
|
|
| 53 |
# Parse the model's response
|
| 54 |
if 'function_call' in output and 'name' in output['function_call']:
|
| 55 |
function_name = output['function_call']['name']
|
|
|
|
| 43 |
return "", history + [[user_message, None]] # Add user message to chat history
|
| 44 |
|
| 45 |
def bot(history):
|
| 46 |
+
if history:
|
| 47 |
+
user_message = history[-1][0]
|
| 48 |
+
payload = {
|
| 49 |
+
"inputs": user_message,
|
| 50 |
+
"parameters": {"function_call": "auto"}
|
| 51 |
+
}
|
| 52 |
+
output = query_model(payload)
|
| 53 |
+
else:
|
| 54 |
+
return history # Or some default response if history is empty
|
| 55 |
# Parse the model's response
|
| 56 |
if 'function_call' in output and 'name' in output['function_call']:
|
| 57 |
function_name = output['function_call']['name']
|