Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -58,16 +58,30 @@ st.write("This model will score your reviews in your CSV file and generate a rep
|
|
58 |
# Load models with caching to avoid reloading on every run
|
59 |
@st.cache_resource
|
60 |
def load_models():
|
|
|
|
|
|
|
61 |
try:
|
62 |
-
|
|
|
|
|
|
|
|
|
63 |
except Exception as e:
|
64 |
st.error(f"Error loading score model: {e}")
|
65 |
-
|
66 |
try:
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
except Exception as e:
|
69 |
st.error(f"Error loading Gemma model: {e}")
|
70 |
-
|
|
|
71 |
return score_pipe, gemma_pipe
|
72 |
|
73 |
|
|
|
58 |
# Load models with caching to avoid reloading on every run
|
59 |
@st.cache_resource
|
60 |
def load_models():
|
61 |
+
score_pipe = None
|
62 |
+
gemma_pipe = None
|
63 |
+
|
64 |
try:
|
65 |
+
st.info("Loading sentiment analysis model...")
|
66 |
+
score_pipe = pipeline("text-classification",
|
67 |
+
model="nlptown/bert-base-multilingual-uncased-sentiment",
|
68 |
+
device=0)
|
69 |
+
st.success("Sentiment analysis model loaded successfully!")
|
70 |
except Exception as e:
|
71 |
st.error(f"Error loading score model: {e}")
|
72 |
+
|
73 |
try:
|
74 |
+
st.info("Loading Gemma model...")
|
75 |
+
# Try with correct model name - either gemma-2-1b-it or gemma-7b-it
|
76 |
+
gemma_pipe = pipeline("text-generation",
|
77 |
+
model="google/gemma-2-1b-it", # Check model name
|
78 |
+
device=0,
|
79 |
+
torch_dtype=torch.bfloat16)
|
80 |
+
st.success("Gemma model loaded successfully!")
|
81 |
except Exception as e:
|
82 |
st.error(f"Error loading Gemma model: {e}")
|
83 |
+
st.error(f"Detailed error: {type(e).__name__}: {str(e)}")
|
84 |
+
|
85 |
return score_pipe, gemma_pipe
|
86 |
|
87 |
|