zxsipola123456 commited on
Commit
69bba44
·
verified ·
1 Parent(s): 4d6ac81

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -16,9 +16,11 @@ def generate_response(question, model_name, endpoint, api_key):
16
  temperature=0.1,
17
  stream=True,
18
  )
 
19
  for chunk in response:
20
- if chunk.choices[0].delta.content is not None:
21
- yield chunk.choices[0].delta.content
 
22
  except Exception as e:
23
  return f"响应生成失败: {str(e)}"
24
 
@@ -123,5 +125,5 @@ with app:
123
  <center><p>Power by sipola </p></center>
124
  </div>
125
  ''')
126
-
127
  app.launch(show_error=True)
 
16
  temperature=0.1,
17
  stream=True,
18
  )
19
+ result = ""
20
  for chunk in response:
21
+ if (delta := chunk.choices[0].delta).get("content"):
22
+ result += delta["content"]
23
+ yield result
24
  except Exception as e:
25
  return f"响应生成失败: {str(e)}"
26
 
 
125
  <center><p>Power by sipola </p></center>
126
  </div>
127
  ''')
128
+ app.queue()
129
  app.launch(show_error=True)