Helder Rodrigues
commited on
Commit
•
b5cfa50
1
Parent(s):
185f3cd
demo
Browse files
app.py
CHANGED
@@ -1,7 +1,23 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
generator = pipeline('text-generation', model='gpt2')
|
|
|
5 |
|
6 |
+
def generate(text):
|
7 |
+
classifier = pipeline("sentiment-analysis")
|
8 |
+
result = classifier(text)
|
9 |
+
return result
|
10 |
+
|
11 |
+
examples = [
|
12 |
+
["SE is the best company in the world!"],
|
13 |
+
["GE is the worst company in the world!"],
|
14 |
+
]
|
15 |
+
|
16 |
+
demo = gr.Interface(
|
17 |
+
fn=generate,
|
18 |
+
inputs=gr.inputs.Textbox(lines=5, label="Input Text"),
|
19 |
+
outputs=gr.outputs.Textbox(label="Generated Text"),
|
20 |
+
examples=examples
|
21 |
+
)
|
22 |
+
|
23 |
+
demo.launch()
|