Pavani2704 commited on
Commit
400ddf8
·
verified ·
1 Parent(s): 499e09b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -6,7 +6,9 @@ from PIL import Image
6
 
7
  pipe = pipeline("summarization", model="google/pegasus-xsum")
8
  agepipe = pipeline("image-classification", model="dima806/facial_age_image_detection")
9
- objpipe = pipeline("zero-shot-object-detection", model="google/owlvit-base-patch32")
 
 
10
  st.title("NLP APP")
11
  option = st.sidebar.selectbox(
12
  "Choose a task",
@@ -33,10 +35,14 @@ elif option == "Object Detection":
33
  st.title("Welcome to object detection")
34
 
35
  uploaded_files = st.file_uploader("Choose a image file",type=["jpg","jpeg"])
36
-
 
37
  if uploaded_files is not None:
38
  Image=Image.open(uploaded_files)
39
- st.write(objpipe(Image)[0]["label"])
 
 
 
40
 
41
 
42
  else:
 
6
 
7
  pipe = pipeline("summarization", model="google/pegasus-xsum")
8
  agepipe = pipeline("image-classification", model="dima806/facial_age_image_detection")
9
+ imgpipe = pipeline("zero-shot-image-classification", model="google/siglip-so400m-patch14-384")
10
+
11
+
12
  st.title("NLP APP")
13
  option = st.sidebar.selectbox(
14
  "Choose a task",
 
35
  st.title("Welcome to object detection")
36
 
37
  uploaded_files = st.file_uploader("Choose a image file",type=["jpg","jpeg"])
38
+ text=st.text_area("Enter possible class names(comma separated")
39
+ candidate_lables=[t.strip() for t in text.split(',')]
40
  if uploaded_files is not None:
41
  Image=Image.open(uploaded_files)
42
+
43
+ outputs = imgpipe(uploaded_files,candidate_lables)
44
+
45
+ st.write(output["label"])
46
 
47
 
48
  else: