Xolkin commited on
Commit
213e053
·
verified ·
1 Parent(s): 3ed0bfe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -10
app.py CHANGED
@@ -29,16 +29,19 @@ def respond(
29
 
30
  response = ""
31
 
32
- for message in client.chat_completion(
33
- messages,
34
- max_tokens=max_tokens,
35
- stream=True,
36
- temperature=temperature,
37
- top_p=top_p,
38
- ):
39
- token = message.choices[0].delta.content
40
- response += token
41
- yield response
 
 
 
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("Предварительный диагноз:")