Spaces:
Sleeping
Sleeping
Download app.py from RaviTez/textgeneration: direct link, hf CLI and curl.
- Browser
- Download file 565 Bytes
-
https://huggingface.co/spaces/RaviTez/textgeneration/resolve/main/app.py
- Command line
-
hf download hf://spaces/RaviTez/textgeneration/app.py
-
curl -L -o app.py https://huggingface.co/spaces/RaviTez/textgeneration/resolve/main/app.py
565 Bytes
| import streamlit as st | |
| from transformers import pipeline | |
| # Load the sentiment analysis pipeline | |
| classifier = pipeline("text-generation") | |
| # Streamlit app | |
| def main(): | |
| st.title("Text Generation App") | |
| # User input | |
| user_input = st.text_input("Enter a sentence:") | |
| if user_input: | |
| # Perform sentiment analysis | |
| result = classifier(user_input) | |
| st.write(result) | |
| # Display results | |
| #st.write("Sentiment:", result[0]['label']) | |
| #st.write("Confidence:", result[0]['score']) | |
| if __name__ == "__main__": | |
| main() | |