File size: 1,386 Bytes
662636f
23752c4
 
6e98be9
 
23752c4
 
6e98be9
dfb1734
bfb2729
 
 
8218770
bfb2729
 
 
 
991d32c
 
1b40fc5
991d32c
 
9b49413
eb0b5b4
6e98be9
 
 
 
 
dfb1734
6e98be9
dfb1734
 
 
499e09b
dfb1734
 
 
 
 
bfb2729
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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")
objpipe = pipeline("zero-shot-object-detection", model="google/owlvit-base-patch32") 
st.title("NLP APP")
option = st.sidebar.selectbox(
    "Choose a task",
    ("Summarization", "Age Detection", "Emotion Detection", "Object Detection")
)
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")

    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"])
elif option == "Object Detection":
    st.title("Welcome to object detection")

    uploaded_files = st.file_uploader("Choose a image file",type=["jpg","jpeg"])

    if uploaded_files is not None:
        Image=Image.open(uploaded_files)
        st.write(objpipe(Image)[0]["label"])
        

else:
    st.title("None")