Spaces:
Sleeping
Sleeping
Better version withou issues
Browse files
app.py
CHANGED
|
@@ -478,7 +478,7 @@ class BotanistAssistant:
|
|
| 478 |
timeout=30 # 30-second timeout
|
| 479 |
)
|
| 480 |
response.raise_for_status()
|
| 481 |
-
return response.json()
|
| 482 |
except requests.exceptions.RequestException as e:
|
| 483 |
print(f"API request failed: {str(e)}")
|
| 484 |
return {"error": str(e)}
|
|
@@ -526,7 +526,7 @@ class BotanistAssistant:
|
|
| 526 |
if "choices" in api_response:
|
| 527 |
for choice in api_response["choices"]:
|
| 528 |
if "message" in choice and "content" in choice["message"]:
|
| 529 |
-
yield choice["message"]["content"]
|
| 530 |
|
| 531 |
def create_app(api_endpoint: str) -> gr.Blocks:
|
| 532 |
"""Creates and configures the Gradio interface."""
|
|
@@ -561,8 +561,9 @@ def create_app(api_endpoint: str) -> gr.Blocks:
|
|
| 561 |
)
|
| 562 |
|
| 563 |
gr.Markdown("---")
|
| 564 |
-
gr.Markdown("> Note: Recommendations can work as real cure treatment but you can consider it as informational purposes only.
|
| 565 |
-
|
|
|
|
| 566 |
|
| 567 |
return demo
|
| 568 |
|
|
|
|
| 478 |
timeout=30 # 30-second timeout
|
| 479 |
)
|
| 480 |
response.raise_for_status()
|
| 481 |
+
return response.json() #-_-
|
| 482 |
except requests.exceptions.RequestException as e:
|
| 483 |
print(f"API request failed: {str(e)}")
|
| 484 |
return {"error": str(e)}
|
|
|
|
| 526 |
if "choices" in api_response:
|
| 527 |
for choice in api_response["choices"]:
|
| 528 |
if "message" in choice and "content" in choice["message"]:
|
| 529 |
+
yield choice["message"]["content"].split("**Sponsor**")[0].split("Sponsor")[0]
|
| 530 |
|
| 531 |
def create_app(api_endpoint: str) -> gr.Blocks:
|
| 532 |
"""Creates and configures the Gradio interface."""
|
|
|
|
| 561 |
)
|
| 562 |
|
| 563 |
gr.Markdown("---")
|
| 564 |
+
gr.Markdown("""> Note: Recommendations can work as real cure treatment but you can consider it as informational purposes only.
|
| 565 |
+
Also You can consult a Natrual healthcare professional before use.""")
|
| 566 |
+
|
| 567 |
|
| 568 |
return demo
|
| 569 |
|