Update app.py
Browse files
app.py
CHANGED
|
@@ -1,21 +1,25 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from inference import SentimentClassifier
|
| 3 |
from huggingface_hub import snapshot_download
|
|
|
|
| 4 |
import os
|
| 5 |
|
| 6 |
MODEL_ID = "vuminhtue/qwen3_sentiment_tinystories"
|
|
|
|
|
|
|
| 7 |
LOCAL_DIR = os.path.join(os.getcwd(), "models", "qwen3_sentiment_tinystories")
|
| 8 |
|
| 9 |
-
|
| 10 |
-
repo_id=
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
)
|
| 15 |
|
| 16 |
|
| 17 |
# Load classifier
|
| 18 |
-
classifier = SentimentClassifier("
|
|
|
|
| 19 |
|
| 20 |
def predict_sentiment(text):
|
| 21 |
"""Predict sentiment and return results"""
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from inference import SentimentClassifier
|
| 3 |
from huggingface_hub import snapshot_download
|
| 4 |
+
from huggingface_hub import hf_hub_download
|
| 5 |
import os
|
| 6 |
|
| 7 |
MODEL_ID = "vuminhtue/qwen3_sentiment_tinystories"
|
| 8 |
+
FILENAME = "Qwen3_200k_model_params.pt"
|
| 9 |
+
|
| 10 |
LOCAL_DIR = os.path.join(os.getcwd(), "models", "qwen3_sentiment_tinystories")
|
| 11 |
|
| 12 |
+
weights_path = hf_hub_download(
|
| 13 |
+
repo_id=MODEL_REPO,
|
| 14 |
+
filename=FILENAME,
|
| 15 |
+
local_dir="models/qwen3_sentiment_tinystories", # any folder in runtime
|
| 16 |
+
local_dir_use_symlinks=None # not needed anymore; safe to omit
|
| 17 |
)
|
| 18 |
|
| 19 |
|
| 20 |
# Load classifier
|
| 21 |
+
classifier = SentimentClassifier(model_dir="models/qwen3_sentiment_tinystories",
|
| 22 |
+
weights_path=weights_path)
|
| 23 |
|
| 24 |
def predict_sentiment(text):
|
| 25 |
"""Predict sentiment and return results"""
|