Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,8 +4,8 @@ from PIL import Image
|
|
| 4 |
import requests
|
| 5 |
|
| 6 |
# Load the model and processor
|
| 7 |
-
processor = ViTImageProcessor.from_pretrained('
|
| 8 |
-
model = AutoModelForImageClassification.from_pretrained('
|
| 9 |
|
| 10 |
# Define prediction function
|
| 11 |
def predict_image(image_url):
|
|
@@ -29,9 +29,9 @@ def predict_image(image_url):
|
|
| 29 |
# Create Gradio interface
|
| 30 |
iface = gr.Interface(
|
| 31 |
fn=predict_image,
|
| 32 |
-
inputs=gr.
|
| 33 |
-
outputs=gr.
|
| 34 |
-
title="NSFW Image
|
| 35 |
)
|
| 36 |
|
| 37 |
# Launch the interface
|
|
|
|
| 4 |
import requests
|
| 5 |
|
| 6 |
# Load the model and processor
|
| 7 |
+
processor = ViTImageProcessor.from_pretrained('AdamCodd/vit-base-nsfw-detector')
|
| 8 |
+
model = AutoModelForImageClassification.from_pretrained('AdamCodd/vit-base-nsfw-detector')
|
| 9 |
|
| 10 |
# Define prediction function
|
| 11 |
def predict_image(image_url):
|
|
|
|
| 29 |
# Create Gradio interface
|
| 30 |
iface = gr.Interface(
|
| 31 |
fn=predict_image,
|
| 32 |
+
inputs=gr.Textbox(label="Image URL"),
|
| 33 |
+
outputs=gr.Textbox(label="Predicted Class"),
|
| 34 |
+
title="NSFW Image Classifier"
|
| 35 |
)
|
| 36 |
|
| 37 |
# Launch the interface
|