Spaces:
Paused
Paused
Download app.py from pgc3105/emodet: direct link, hf CLI and curl.
- Browser
- Download file 497 Bytes
-
https://huggingface.co/spaces/pgc3105/emodet/resolve/main/app.py
- Command line
-
hf download hf://spaces/pgc3105/emodet/app.py
-
curl -L -o app.py https://huggingface.co/spaces/pgc3105/emodet/resolve/main/app.py
497 Bytes
| # from flask import Flask, request, jsonify | |
| from sentiments import Sentiments | |
| import gradio as gr | |
| # import json | |
| def emo_calc(input): | |
| model="j-hartmann/emotion-english-distilroberta-base" | |
| snt = Sentiments(model, input, as_dict=False) | |
| output = input + "\n" | |
| float_dict = snt.get_sentiments_for_text(input) | |
| for k, v in float_dict.items(): | |
| output += f"{k}: {100 * v:.2f}%\n" | |
| return output | |
| demo = gr.Interface(fn=emo_calc, inputs="text", outputs="text") | |
| demo.launch() | |