Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- app.py +14 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
pipe = pipeline("image-classification", "umm-maybe/AI-image-detector")
|
5 |
+
|
6 |
+
def image_classifier(image):
|
7 |
+
outputs = pipe(image)
|
8 |
+
results = {}
|
9 |
+
for result in outputs:
|
10 |
+
results[result['label']] = result['score']
|
11 |
+
return results
|
12 |
+
|
13 |
+
demo = gr.Interface(fn=image_classifier, inputs=gr.Image(type="pil"), outputs="label")
|
14 |
+
demo.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
torch
|
2 |
+
transformers
|
3 |
+
pillow
|