Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
|
@@ -27,3 +28,37 @@ iface = gr.Interface(fn=get_sentiment,
|
|
| 27 |
)
|
| 28 |
|
| 29 |
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
from transformers import pipeline
|
| 3 |
import gradio as gr
|
| 4 |
import torch
|
|
|
|
| 28 |
)
|
| 29 |
|
| 30 |
iface.launch()
|
| 31 |
+
"""
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
from transformers import pipeline
|
| 35 |
+
import gradio as gr
|
| 36 |
+
import torch
|
| 37 |
+
|
| 38 |
+
from pysentimiento import create_analyzer
|
| 39 |
+
analyzer = create_analyzer(task="sentiment", lang="pt")
|
| 40 |
+
|
| 41 |
+
def get_sentiment(input_text):
|
| 42 |
+
return analyzer(input_text)
|
| 43 |
+
|
| 44 |
+
app_examples = [
|
| 45 |
+
['Não estou em minha melhor versão'],
|
| 46 |
+
['Relaxado como nunca'],
|
| 47 |
+
['Tentando relaxar, porém preocupado ']
|
| 48 |
+
]
|
| 49 |
+
|
| 50 |
+
inputs = [
|
| 51 |
+
gr.Textbox(value=app_examples[0][0]),
|
| 52 |
+
]
|
| 53 |
+
|
| 54 |
+
iface = gr.Interface(fn=get_sentiment,
|
| 55 |
+
inputs=inputs,
|
| 56 |
+
outputs=["text"],
|
| 57 |
+
title='Sentiment Analysis',
|
| 58 |
+
description='Obtenha o sentimento do texto digitado 😄|😠',
|
| 59 |
+
examples= app_examples,
|
| 60 |
+
theme="gradio/monochrome"
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
iface.launch()
|
| 64 |
+
|