Spaces:
Runtime error
Runtime error
Download app.py from rabindra-sss/SentimentPro: direct link, hf CLI and curl.
- Browser
- Download file 593 Bytes
-
https://huggingface.co/spaces/rabindra-sss/SentimentPro/resolve/main/app.py
- Command line
-
hf download hf://spaces/rabindra-sss/SentimentPro/app.py
-
curl -L -o app.py https://huggingface.co/spaces/rabindra-sss/SentimentPro/resolve/main/app.py
593 Bytes
| import streamlit as st | |
| from fastapi import FastAPI | |
| from pydantic import BaseModel | |
| from backend import predict | |
| st.title("Classify Sentiment") | |
| text= st.text_area("Enter your text") | |
| if(text): | |
| prediction= predict(text) | |
| st.header(prediction) | |
| st.json({"sentiment": prediction}) | |
| app = FastAPI() | |
| class Input(BaseModel): | |
| text: str | |
| async def root(): | |
| return {"message": "SentimentPro API is running!"} | |
| async def predict_sentiment(input: Input): | |
| prediction = predict(input.text) | |
| return {"text": input.text, "sentiment": prediction} |