File size: 543 Bytes
7217a85
 
 
 
 
 
 
 
 
 
 
537f649
7217a85
 
 
537f649
7217a85
 
 
 
537f649
7217a85
 
 
 
 
 
537f649
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# https://huggingface.co/spaces/Zoltan100/test

# import gradio as gr
#
# def greet(name):
#     return "Hello " + name + "!!"
#
# demo = gr.Interface(fn=greet, inputs="text", outputs="text")
# demo.launch()


import gradio as gr
from transformers import pipeline

model = pipeline("sentiment-analysis")

# Define inference function
def predict(text):
    outputs = model(text)
    return outputs

# Create Gradio interface
demo = gr.Interface(
    fn=predict, 
    inputs="text", outputs="text",
    title="Sentiment Analysis"
)
demo.launch()