Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -3,13 +3,8 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
|
|
| 3 |
import torch
|
| 4 |
import gradio as gr
|
| 5 |
import spaces
|
| 6 |
-
from dotenv import load_dotenv
|
| 7 |
|
| 8 |
-
load_dotenv()
|
| 9 |
|
| 10 |
-
os.environ["HF_TOKEN"] = os.getenv("HF_TOKEN")
|
| 11 |
-
|
| 12 |
-
torch.cuda.empty_cache()
|
| 13 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 14 |
|
| 15 |
model_name = "syubraj/MedicalChat-Phi-3.5-mini-instruct"
|
|
@@ -31,6 +26,8 @@ def generate_response(user_query: str, system_message: str = None, max_length: i
|
|
| 31 |
:param max_length: Max tokens to generate.
|
| 32 |
:return: Generated assistant response.
|
| 33 |
"""
|
|
|
|
|
|
|
| 34 |
if not user_query.strip():
|
| 35 |
return "Error: User query cannot be empty."
|
| 36 |
|
|
|
|
| 3 |
import torch
|
| 4 |
import gradio as gr
|
| 5 |
import spaces
|
|
|
|
| 6 |
|
|
|
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 9 |
|
| 10 |
model_name = "syubraj/MedicalChat-Phi-3.5-mini-instruct"
|
|
|
|
| 26 |
:param max_length: Max tokens to generate.
|
| 27 |
:return: Generated assistant response.
|
| 28 |
"""
|
| 29 |
+
torch.cuda.empty_cache()
|
| 30 |
+
|
| 31 |
if not user_query.strip():
|
| 32 |
return "Error: User query cannot be empty."
|
| 33 |
|