Spaces:
Runtime error
Runtime error
Ömer Faruk Özdemir
commited on
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
with gr.Blocks() as demo:
|
4 |
+
gr.Markdown(
|
5 |
+
"""
|
6 |
+
# Find Your Siblings
|
7 |
+
|
8 |
+
Upload your face and find the most similar people from the X dataset. Powered by Upstash Vector 🚀
|
9 |
+
"""
|
10 |
+
)
|
11 |
+
|
12 |
+
with gr.Tab("Basic"):
|
13 |
+
with gr.Row():
|
14 |
+
with gr.Column(scale=1):
|
15 |
+
input_image = gr.Image()
|
16 |
+
with gr.Column(scale=3):
|
17 |
+
output_image = gr.Gallery()
|
18 |
+
|
19 |
+
|
20 |
+
@input_image.change(inputs=input_image, outputs=output_image)
|
21 |
+
def find_similar_faces(image):
|
22 |
+
return [image]
|
23 |
+
|
24 |
+
with gr.Tab("Advanced"):
|
25 |
+
with gr.Row():
|
26 |
+
with gr.Column(scale=1):
|
27 |
+
adv_input_image = gr.Image()
|
28 |
+
adv_image_count = gr.Number(9, label="Image Count")
|
29 |
+
|
30 |
+
with gr.Column(scale=3):
|
31 |
+
adv_output_image = gr.Gallery(height=1000)
|
32 |
+
|
33 |
+
|
34 |
+
@adv_input_image.change(inputs=[adv_input_image, adv_image_count], outputs=[adv_output_image])
|
35 |
+
def find_similar_faces(image, count):
|
36 |
+
return [image] * count
|
37 |
+
|
38 |
+
if __name__ == "__main__":
|
39 |
+
demo.launch()
|