Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import transformers | |
| from transformers import pipeline | |
| import PIL | |
| from PIL import Image | |
| pipe = pipeline("summarization", model="google/pegasus-xsum") | |
| agepipe = pipeline("image-classification", model="dima806/facial_age_image_detection") | |
| st.title("NLP APP") | |
| option = st.sidebar.selectbox( | |
| "Choose a task", | |
| ("Summarization", "Age Detection", "Emotion Detection", "Image Generation") | |
| ) | |
| if option == "Summarization": | |
| st.title("Text Summarization") | |
| text = st.text_area("Enter text to summarize") | |
| if st.button("Summarize"): | |
| if text: | |
| st.write("Summary:", pipe(text)[0]["summary_text"]) | |
| else: | |
| st.write("Please enter text to summarize.") | |
| elif option == "Age Detection" | |
| st.title("welcome to age detection app") | |
| uploaded_files = st.file_uploader("Choose a image file",type="jpg") | |
| if uploaded_files is not None: | |
| Image=Image.open(uploaded_files) | |
| st.write(agepipe(Image)[0]["label"]) | |
| else: | |
| st.title("None") |