aifeifei798 commited on
Commit
73adad0
·
verified ·
1 Parent(s): 659a7c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -40,10 +40,12 @@ def feifeichat(image):
40
  "stream": False,
41
  }]
42
 
43
-
44
- partial_message = Mistralclient.chat.stream(model=model, messages=messages)
45
- print(partial_message)
46
- return partial_message.choices[0].message.content
 
 
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"