Spaces:
Runtime error
Runtime error
Commit
Β·
f95c130
1
Parent(s):
6220981
Update app.py
Browse files
app.py
CHANGED
@@ -23,11 +23,9 @@ def summarize_text(text, model_path="leadingbridge/summarization"):
|
|
23 |
return summary
|
24 |
|
25 |
# Sentiment Analysis Pre-Trained Model
|
26 |
-
model_path
|
27 |
-
tokenizer = BertTokenizerFast.from_pretrained(model_path)
|
28 |
-
model = TFBertForSequenceClassification.from_pretrained(model_path, id2label=
|
29 |
-
|
30 |
-
def sentiment_analysis(text):
|
31 |
pipe = TextClassificationPipeline(model=model, tokenizer=tokenizer)
|
32 |
result = pipe(text)
|
33 |
return result
|
|
|
23 |
return summary
|
24 |
|
25 |
# Sentiment Analysis Pre-Trained Model
|
26 |
+
def sentiment_analysis(text, model_path="leadingbridge/sentiment-analysis", id2label={0: 'negative', 1: 'positive'}):
|
27 |
+
tokenizer = BertTokenizerFast.from_pretrained(model_path)
|
28 |
+
model = TFBertForSequenceClassification.from_pretrained(model_path, id2label=id2label)
|
|
|
|
|
29 |
pipe = TextClassificationPipeline(model=model, tokenizer=tokenizer)
|
30 |
result = pipe(text)
|
31 |
return result
|