Spaces:
Runtime error
Runtime error
Delete pipeline.py
Browse files- pipeline.py +0 -24
pipeline.py
DELETED
|
@@ -1,24 +0,0 @@
|
|
| 1 |
-
from transformers import pipeline
|
| 2 |
-
from utils import clean_text, generate_wordcloud
|
| 3 |
-
|
| 4 |
-
# Load Hugging Face models
|
| 5 |
-
sentiment_model = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")
|
| 6 |
-
summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")
|
| 7 |
-
|
| 8 |
-
def process_comment(text):
|
| 9 |
-
# Clean text
|
| 10 |
-
cleaned = clean_text(text)
|
| 11 |
-
|
| 12 |
-
# Sentiment
|
| 13 |
-
sentiment = sentiment_model(cleaned)[0]
|
| 14 |
-
|
| 15 |
-
# Summary
|
| 16 |
-
try:
|
| 17 |
-
summary = summarizer(cleaned, max_length=60, min_length=10, do_sample=False)[0]["summary_text"]
|
| 18 |
-
except:
|
| 19 |
-
summary = "Summary not available (text too short)."
|
| 20 |
-
|
| 21 |
-
# Word cloud
|
| 22 |
-
wc_img = generate_wordcloud(cleaned)
|
| 23 |
-
|
| 24 |
-
return sentiment, summary, wc_img
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|