| # 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() |