Update app.py
Browse files
app.py
CHANGED
@@ -29,16 +29,19 @@ def respond(
|
|
29 |
|
30 |
response = ""
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
42 |
|
43 |
# Highlight the diagnosis in bold
|
44 |
diagnosis_start = response.find("Предварительный диагноз:")
|
|
|
29 |
|
30 |
response = ""
|
31 |
|
32 |
+
try:
|
33 |
+
for message in client.chat_completion(
|
34 |
+
messages,
|
35 |
+
max_tokens=max_tokens,
|
36 |
+
stream=True,
|
37 |
+
temperature=temperature,
|
38 |
+
top_p=top_p,
|
39 |
+
):
|
40 |
+
token = message.choices[0].delta.content
|
41 |
+
response += token
|
42 |
+
yield response
|
43 |
+
except Exception as e:
|
44 |
+
yield f"An error occurred: {e}"
|
45 |
|
46 |
# Highlight the diagnosis in bold
|
47 |
diagnosis_start = response.find("Предварительный диагноз:")
|