Shabbir-Anjum commited on
Commit
0bc527f
1 Parent(s): 17cf036

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import streamlit as st
2
- from transformers import pipeline, AutoImageProcessor, AutoModelForImageClassification
3
  from PIL import Image
4
 
5
  # Title of the web app
@@ -19,12 +19,8 @@ if uploaded_file is not None:
19
  image = Image.open(uploaded_file)
20
  st.image(image, caption="Uploaded Image", use_column_width=True)
21
 
22
- # Load the model and processor
23
- processor = AutoImageProcessor.from_pretrained("Falconsai/nsfw_image_detection")
24
- model = AutoModelForImageClassification.from_pretrained("Falconsai/nsfw_image_detection")
25
-
26
- # Use the pipeline for image classification
27
- pipe = pipeline("image-classification", model=model, feature_extractor=processor)
28
 
29
  # Classify the image
30
  with st.spinner('Classifying...'):
 
1
  import streamlit as st
2
+ from transformers import pipeline
3
  from PIL import Image
4
 
5
  # Title of the web app
 
19
  image = Image.open(uploaded_file)
20
  st.image(image, caption="Uploaded Image", use_column_width=True)
21
 
22
+ # Load the model using the pipeline
23
+ pipe = pipeline("image-classification", model="Falconsai/nsfw_image_detection")
 
 
 
 
24
 
25
  # Classify the image
26
  with st.spinner('Classifying...'):