Update app.py
Browse files
app.py
CHANGED
|
@@ -73,11 +73,23 @@ model_id_7 = "oliverguhr/german-sentiment-bert"
|
|
| 73 |
|
| 74 |
from transformers import pipeline
|
| 75 |
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
#pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
|
| 78 |
|
| 79 |
def predict(text):
|
| 80 |
-
|
|
|
|
|
|
|
| 81 |
|
| 82 |
demo = gr.Interface(
|
| 83 |
fn=predict,
|
|
|
|
| 73 |
|
| 74 |
from transformers import pipeline
|
| 75 |
|
| 76 |
+
#
|
| 77 |
+
##
|
| 78 |
+
#"['audio-classification', 'automatic-speech-recognition', 'conversational', 'depth-estimation', 'document-question-answering',
|
| 79 |
+
#'feature-extraction', 'fill-mask', 'image-classification', 'image-segmentation', 'image-to-text', 'mask-generation', 'ner',
|
| 80 |
+
#'object-detection', 'question-answering', 'sentiment-analysis', 'summarization', 'table-question-answering', 'text-classification',
|
| 81 |
+
#'text-generation', 'text2text-generation', 'token-classification', 'translation', 'video-classification', 'visual-question-answering',
|
| 82 |
+
#'vqa', 'zero-shot-audio-classification', 'zero-shot-classification', 'zero-shot-image-classification', 'zero-shot-object-detection',
|
| 83 |
+
#'translation_XX_to_YY']"
|
| 84 |
+
##
|
| 85 |
+
|
| 86 |
+
pipe = pipeline("sentiment-analysis", model=model_id_7)
|
| 87 |
#pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
|
| 88 |
|
| 89 |
def predict(text):
|
| 90 |
+
sentiment_result = pipe(text)[0]["sentiment_text"]
|
| 91 |
+
print(sentiment_result)
|
| 92 |
+
return sentiment_result
|
| 93 |
|
| 94 |
demo = gr.Interface(
|
| 95 |
fn=predict,
|