Spaces:
Sleeping
Sleeping
Fix model.
Browse files
app.py
CHANGED
@@ -4,8 +4,15 @@ import streamlit as st
|
|
4 |
import socket
|
5 |
import threading
|
6 |
|
|
|
|
|
|
|
7 |
# Load the pre-trained sentiment-analysis pipeline
|
8 |
-
|
|
|
|
|
|
|
|
|
9 |
|
10 |
# Function to classify sentiment
|
11 |
def classify_text(text):
|
|
|
4 |
import socket
|
5 |
import threading
|
6 |
|
7 |
+
# Specify the model name explicitly to avoid warnings
|
8 |
+
model_name = "distilbert-base-uncased-finetuned-sst-2-english"
|
9 |
+
|
10 |
# Load the pre-trained sentiment-analysis pipeline
|
11 |
+
try:
|
12 |
+
classifier = pipeline('sentiment-analysis', model=model_name)
|
13 |
+
except Exception as e:
|
14 |
+
st.error(f"Error loading pipeline: {e}")
|
15 |
+
st.stop()
|
16 |
|
17 |
# Function to classify sentiment
|
18 |
def classify_text(text):
|