my latest updates…
Browse files- app.py +24 -3
- requirements.txt +2 -0
app.py
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
demo.launch()
|
|
|
|
| 1 |
+
# https://huggingface.co/spaces/Zoltan100/test
|
| 2 |
+
|
| 3 |
+
# import gradio as gr
|
| 4 |
+
#
|
| 5 |
+
# def greet(name):
|
| 6 |
+
# return "Hello " + name + "!!"
|
| 7 |
+
#
|
| 8 |
+
# demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 9 |
+
# demo.launch()
|
| 10 |
+
|
| 11 |
+
|
| 12 |
import gradio as gr
|
| 13 |
+
from transformers import pipeline
|
| 14 |
+
|
| 15 |
+
model = pipeline("sentiment-analysis")
|
| 16 |
|
| 17 |
+
# Define inference function
|
| 18 |
+
def predict(text):
|
| 19 |
+
outputs = model(text)
|
| 20 |
+
return outputs
|
| 21 |
|
| 22 |
+
# Create Gradio interface
|
| 23 |
+
demo = gr.Interface(
|
| 24 |
+
fn=predict,
|
| 25 |
+
inputs="text", outputs="text",
|
| 26 |
+
title="Sentiment Analysis"
|
| 27 |
+
)
|
| 28 |
demo.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
transformers
|