Spaces:
Runtime error
Runtime error
Commit ·
f43f058
1
Parent(s): d77636f
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,19 +20,45 @@ def predict(im1, im2):
|
|
| 20 |
|
| 21 |
|
| 22 |
|
|
|
|
|
|
|
|
|
|
| 23 |
title = 'Face ID'
|
| 24 |
description = 'This model detects the similarity between two images and passes a command!'
|
| 25 |
-
interface = gr.Interface(fn=predict,
|
| 26 |
-
inputs= [gr.Image(type="pil", source="webcam"),
|
| 27 |
-
gr.Image(type="pil", source="webcam")],
|
| 28 |
-
outputs= [gr.Number(label="Similarity"),
|
| 29 |
-
gr.Textbox(label="Message")],
|
| 30 |
-
title = title,
|
| 31 |
-
description = description
|
| 32 |
-
)
|
| 33 |
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
-
interface.launch(debug=True)
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
+
import gradio as gr
|
| 24 |
+
|
| 25 |
+
|
| 26 |
title = 'Face ID'
|
| 27 |
description = 'This model detects the similarity between two images and passes a command!'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
|
| 30 |
+
article = """
|
| 31 |
+
Upload and Image from your Device or Make use of your webcam
|
| 32 |
+
"""
|
| 33 |
+
|
| 34 |
+
img_upload = gr.Interface(
|
| 35 |
+
fn=predict,
|
| 36 |
+
inputs= [gr.Image(type="pil", source="upload"),
|
| 37 |
+
gr.Image(type="pil", source="upload")],
|
| 38 |
+
outputs= [gr.Number(label="Similarity"),
|
| 39 |
+
gr.Textbox(label="Message")],
|
| 40 |
+
title=title,
|
| 41 |
+
description=description,
|
| 42 |
+
article=article
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
webcam_upload = gr.Interface(
|
| 46 |
+
fn=predict,
|
| 47 |
+
inputs= [gr.Image(type="pil", source="webcam"),
|
| 48 |
+
gr.Image(type="pil", source="webcam")],
|
| 49 |
+
outputs= [gr.Number(label="Similarity"),
|
| 50 |
+
gr.Textbox(label="Message")],
|
| 51 |
+
title=title,
|
| 52 |
+
description=description,
|
| 53 |
+
article=article,
|
| 54 |
+
)
|
| 55 |
+
|
| 56 |
+
face_id = gr.TabbedInterface(
|
| 57 |
+
[img_upload, webcam_upload],
|
| 58 |
+
["Upload-Image", "Use Webcam"])
|
| 59 |
+
|
| 60 |
+
face_id.launch(debug=True)
|
| 61 |
+
|
| 62 |
|
| 63 |
|
| 64 |
|
|
|