Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
21 |
-
|
|
|
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)
|