Spaces:
Running
Running
aifeifei798
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -40,10 +40,12 @@ def feifeichat(image):
|
|
40 |
"stream": False,
|
41 |
}]
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
47 |
except Exception as e: # 添加通用异常处理
|
48 |
print(f"Error: {e}")
|
49 |
return "Please upload a photo"
|
|
|
40 |
"stream": False,
|
41 |
}]
|
42 |
|
43 |
+
partial_message = ""
|
44 |
+
for chunk in Mistralclient.chat.stream(model=model, messages=messages):
|
45 |
+
if chunk.data.choices[0].delta.content is not None:
|
46 |
+
partial_message = partial_message + chunk.data.choices[
|
47 |
+
0].delta.content
|
48 |
+
yield partial_message
|
49 |
except Exception as e: # 添加通用异常处理
|
50 |
print(f"Error: {e}")
|
51 |
return "Please upload a photo"
|