Download app.py from Zoltan100/test: direct link, hf CLI and curl.
- Browser
- Download file 543 Bytes
-
https://huggingface.co/spaces/Zoltan100/test/resolve/main/app.py
- Command line
-
hf download hf://spaces/Zoltan100/test/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Zoltan100/test/resolve/main/app.py
543 Bytes
| # 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() |