iambravolee commited on
Commit
41dd38f
1 Parent(s): 2fda00e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ title = "BurstPixel AI Image Detector"
14
+ description = """
15
+ This app is a proof-of-concept demonstration of using a ViT model to predict whether an artistic image was generated using AI.\n
16
+ For more information please see the blog post describing it at:
17
+ https://medium.com/@matthewmaybe/can-an-ai-learn-to-identify-ai-art-545d9d6af226
18
+ """
19
+
20
+ demo = gr.Interface(fn=image_classifier, inputs=gr.Image(type="pil"), outputs="label", title=title, description=description)
21
+ demo.launch(show_api=False)