Create source.py
Browse files
source.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
analyzer = pipeline("sentiment-analysis")
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def greet(name):
|
| 8 |
+
#return "Hello " + name
|
| 9 |
+
return (analyzer(name))
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
# We instantiate the Textbox class
|
| 13 |
+
textbox = gr.Textbox(label="Please fill in something words:",placeholder="happy", lines=2)
|
| 14 |
+
|
| 15 |
+
#textbox = gr.Textbox(label="Type your name here:", placeholder="John Doe", lines=2)
|
| 16 |
+
|
| 17 |
+
gr.Interface(fn=greet, inputs=textbox, outputs="text").launch(share=True)
|