Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,11 +2,21 @@ import gradio as gr
|
|
| 2 |
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
-
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
|
| 6 |
-
|
| 7 |
def predict(text):
|
| 8 |
return pipe(text)[0]["translation_text"]
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
demo = gr.Interface(
|
| 11 |
fn=predict,
|
| 12 |
inputs='text',
|
|
|
|
| 2 |
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
+
"""pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
|
|
|
|
| 6 |
def predict(text):
|
| 7 |
return pipe(text)[0]["translation_text"]
|
| 8 |
|
| 9 |
+
demo = gr.Interface(
|
| 10 |
+
fn=predict,
|
| 11 |
+
inputs='text',
|
| 12 |
+
outputs='text',
|
| 13 |
+
)"""
|
| 14 |
+
|
| 15 |
+
classifier = pipeline("sentiment-analysis", model="michellejieli/emotion_text_classifier")
|
| 16 |
+
|
| 17 |
+
def predict(text):
|
| 18 |
+
return pipe(text)[0]["label"]
|
| 19 |
+
|
| 20 |
demo = gr.Interface(
|
| 21 |
fn=predict,
|
| 22 |
inputs='text',
|