Update app.py
Browse files
app.py
CHANGED
@@ -172,12 +172,13 @@ def predict(input_image:Image.Image, true_label:str):
|
|
172 |
}
|
173 |
return confidences, true_label, face_with_mask
|
174 |
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
|
179 |
-
|
180 |
|
|
|
181 |
interface1 = gr.Interface(
|
182 |
fn=predict,
|
183 |
inputs=[
|
@@ -191,15 +192,16 @@ interface1 = gr.Interface(
|
|
191 |
#ValueError: Invalid value for parameter `type`: auto. Please choose from one of: ['numpy', 'pil', 'filepath']
|
192 |
],
|
193 |
theme = my_theme, #gr.themes.Soft(),
|
194 |
-
title =
|
195 |
-
description =
|
196 |
-
article =
|
197 |
#examples=[[examples[i]["path"], examples[i]["label"]] for i in range(10)]
|
198 |
)
|
|
|
199 |
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
NOTE:
|
204 |
- To detect pictures generated using older models such as VQGAN+CLIP, please use the updated version of this detector instead.
|
205 |
- In this model i'm using a ViT model to predict whether an artistic image was generated using AI or not.
|
@@ -209,11 +211,11 @@ NOTE:
|
|
209 |
- Images scoring as very probably artificial (e.g. 90% or higher) could be referred to a human expert for further investigation, if needed.
|
210 |
"""
|
211 |
|
212 |
-
|
213 |
|
214 |
#demo.launch(show_api=False)
|
215 |
|
216 |
-
|
217 |
interface2 = gr.Interface(
|
218 |
fn=image_classifier,
|
219 |
inputs=[
|
@@ -231,8 +233,8 @@ interface2 = gr.Interface(
|
|
231 |
description = description1,
|
232 |
article = article1
|
233 |
)
|
234 |
-
|
235 |
|
236 |
gr.TabbedInterface(
|
237 |
[interface1, interface2], ["Deepfake Image Detection", "AI Image Detection"]
|
238 |
-
).launch() #share=True)
|
|
|
172 |
}
|
173 |
return confidences, true_label, face_with_mask
|
174 |
|
175 |
+
title1 = "Deepfake Image Detection"
|
176 |
+
description1 = "~ AI - ML implementation for fake and real image detection..."
|
177 |
+
article1 = "<p style='text-align: center'>...</p>"
|
178 |
|
179 |
+
interface1 = gr.Interface(fn=predict, inputs=gr.Image(type="pil"), outputs="label", theme = my_theme, title=title1, description=description1, article = article1)
|
180 |
|
181 |
+
'''
|
182 |
interface1 = gr.Interface(
|
183 |
fn=predict,
|
184 |
inputs=[
|
|
|
192 |
#ValueError: Invalid value for parameter `type`: auto. Please choose from one of: ['numpy', 'pil', 'filepath']
|
193 |
],
|
194 |
theme = my_theme, #gr.themes.Soft(),
|
195 |
+
title = title1,
|
196 |
+
description = description1,
|
197 |
+
article = article1
|
198 |
#examples=[[examples[i]["path"], examples[i]["label"]] for i in range(10)]
|
199 |
)
|
200 |
+
'''
|
201 |
|
202 |
+
title2 = "AI Generated Image Detection"
|
203 |
+
description2 = "~ AI - ML implementation for AI image detection using older models such as VQGAN+CLIP."
|
204 |
+
article2 = """
|
205 |
NOTE:
|
206 |
- To detect pictures generated using older models such as VQGAN+CLIP, please use the updated version of this detector instead.
|
207 |
- In this model i'm using a ViT model to predict whether an artistic image was generated using AI or not.
|
|
|
211 |
- Images scoring as very probably artificial (e.g. 90% or higher) could be referred to a human expert for further investigation, if needed.
|
212 |
"""
|
213 |
|
214 |
+
interface2 = gr.Interface(fn=image_classifier, inputs=gr.Image(type="pil"), outputs="label", theme = my_theme, title=title2, description=description2, article = article2)
|
215 |
|
216 |
#demo.launch(show_api=False)
|
217 |
|
218 |
+
'''
|
219 |
interface2 = gr.Interface(
|
220 |
fn=image_classifier,
|
221 |
inputs=[
|
|
|
233 |
description = description1,
|
234 |
article = article1
|
235 |
)
|
236 |
+
'''
|
237 |
|
238 |
gr.TabbedInterface(
|
239 |
[interface1, interface2], ["Deepfake Image Detection", "AI Image Detection"]
|
240 |
+
).launch() #share=True)
|