Spaces:
Sleeping
Sleeping
Final Fix π
Browse files
app.py
CHANGED
|
@@ -522,8 +522,8 @@ class BotanistAssistant:
|
|
| 522 |
top_p=0.9,
|
| 523 |
extra_body={"top_k": 50},
|
| 524 |
messages=messages)
|
| 525 |
-
|
| 526 |
-
return response.to_json()
|
| 527 |
|
| 528 |
except Exception as e:
|
| 529 |
print(f"Error: {str(e)}")
|
|
@@ -577,11 +577,14 @@ class BotanistAssistant:
|
|
| 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"][0]:
|
| 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:
|
| 587 |
"""Creates and configures the Gradio interface."""
|
|
|
|
| 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:
|
| 529 |
print(f"Error: {str(e)}")
|
|
|
|
| 577 |
#yield treatment_response # First yield the treatment info
|
| 578 |
|
| 579 |
# Stream additional assistant responses if available
|
| 580 |
+
if api_response:
|
| 581 |
+
yield api_response
|
| 582 |
+
'''
|
| 583 |
if "choices" in api_response:
|
| 584 |
for choice in api_response["choices"][0]:
|
| 585 |
if "message" in choice and "content" in choice["message"]:
|
| 586 |
yield choice["message"]["content"]
|
| 587 |
+
'''
|
| 588 |
|
| 589 |
def create_app(api_endpoint: str = "https://api.studio.nebius.com/v1/") -> gr.Blocks:
|
| 590 |
"""Creates and configures the Gradio interface."""
|