XMMR12 commited on
Commit
2b58ee1
·
verified ·
1 Parent(s): 8dabb5d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -261,7 +261,7 @@ def analyze_symptoms_from_text_ai(text_input: str) -> str:
261
 
262
  # Extract and clean the response
263
  try:
264
- symptoms_csv = response.choices.message.content.strip()
265
  return symptoms_csv
266
  except Exception as e:
267
  print ("Error:",e,"\nType 'response': ",type(response),"\n",response)
@@ -351,7 +351,7 @@ If multiple plants could work well, you may recommend up to 3 options."""
351
  ]
352
  )
353
 
354
- final_result = response.choices.message.content
355
 
356
  # Step 5: Append detailed plant information if available
357
  if all_related_plants:
@@ -522,6 +522,7 @@ class BotanistAssistant:
522
  top_p=0.9,
523
  extra_body={"top_k": 50},
524
  messages=messages)
 
525
  return response.to_json()
526
 
527
  except Exception as e:
@@ -574,13 +575,12 @@ class BotanistAssistant:
574
  # Get treatment information
575
  #treatment_response = search_for_treatment_answer_ai(message)
576
  #yield treatment_response # First yield the treatment info
577
-
578
  # Stream additional assistant responses if available
579
  if "choices" in api_response:
580
  for choice in api_response["choices"]:
581
  if "message" in choice and "content" in choice["message"]:
582
  yield choice["message"]["content"]
583
-
584
 
585
 
586
  def create_app(api_endpoint: str = "https://api.studio.nebius.com/v1/") -> gr.Blocks:
 
261
 
262
  # Extract and clean the response
263
  try:
264
+ symptoms_csv = response.choices[0].message.content.strip()
265
  return symptoms_csv
266
  except Exception as e:
267
  print ("Error:",e,"\nType 'response': ",type(response),"\n",response)
 
351
  ]
352
  )
353
 
354
+ final_result = response.choices[0].message.content
355
 
356
  # Step 5: Append detailed plant information if available
357
  if all_related_plants:
 
522
  top_p=0.9,
523
  extra_body={"top_k": 50},
524
  messages=messages)
525
+ #return response.choices[0].message.content #TODO if not working
526
  return response.to_json()
527
 
528
  except Exception as e:
 
575
  # Get treatment information
576
  #treatment_response = search_for_treatment_answer_ai(message)
577
  #yield treatment_response # First yield the treatment info
578
+
579
  # Stream additional assistant responses if available
580
  if "choices" in api_response:
581
  for choice in api_response["choices"]:
582
  if "message" in choice and "content" in choice["message"]:
583
  yield choice["message"]["content"]
 
584
 
585
 
586
  def create_app(api_endpoint: str = "https://api.studio.nebius.com/v1/") -> gr.Blocks: