Spaces:
Runtime error
Runtime error
omerXfaruq
commited on
Commit
•
b2f105a
1
Parent(s):
83305ef
- tweaks
Browse files- app.py +12 -7
- requirements.txt +0 -1
app.py
CHANGED
@@ -24,8 +24,8 @@ with gr.Blocks() as demo:
|
|
24 |
with gr.Row():
|
25 |
with gr.Column(scale=1):
|
26 |
input_image = gr.Image(type="pil")
|
27 |
-
with gr.Column(scale=
|
28 |
-
output_image = gr.Gallery(height=
|
29 |
|
30 |
|
31 |
@input_image.change(inputs=input_image, outputs=output_image)
|
@@ -40,7 +40,7 @@ with gr.Blocks() as demo:
|
|
40 |
|
41 |
|
42 |
gr.Examples(
|
43 |
-
examples=[dataset["train"][6]["image"]],
|
44 |
inputs=input_image,
|
45 |
outputs=output_image,
|
46 |
fn=find_similar_faces,
|
@@ -52,12 +52,13 @@ with gr.Blocks() as demo:
|
|
52 |
with gr.Column(scale=1):
|
53 |
adv_input_image = gr.Image(type="pil")
|
54 |
adv_image_count = gr.Number(9, label="Image Count")
|
|
|
55 |
|
56 |
-
with gr.Column(scale=
|
57 |
-
adv_output_image = gr.Gallery(
|
58 |
|
59 |
|
60 |
-
@
|
61 |
async def find_similar_faces(image, count):
|
62 |
inputs = extractor(images=image, return_tensors="pt")
|
63 |
outputs = model(**inputs)
|
@@ -67,5 +68,9 @@ with gr.Blocks() as demo:
|
|
67 |
)
|
68 |
return [dataset["train"][int(vector.id)]["image"] for vector in result]
|
69 |
|
|
|
|
|
|
|
|
|
70 |
if __name__ == "__main__":
|
71 |
-
demo.launch(debug=True)
|
|
|
24 |
with gr.Row():
|
25 |
with gr.Column(scale=1):
|
26 |
input_image = gr.Image(type="pil")
|
27 |
+
with gr.Column(scale=2):
|
28 |
+
output_image = gr.Gallery(height=450)
|
29 |
|
30 |
|
31 |
@input_image.change(inputs=input_image, outputs=output_image)
|
|
|
40 |
|
41 |
|
42 |
gr.Examples(
|
43 |
+
examples=[dataset["train"][6]["image"], dataset["train"][7]["image"], dataset["train"][8]["image"]],
|
44 |
inputs=input_image,
|
45 |
outputs=output_image,
|
46 |
fn=find_similar_faces,
|
|
|
52 |
with gr.Column(scale=1):
|
53 |
adv_input_image = gr.Image(type="pil")
|
54 |
adv_image_count = gr.Number(9, label="Image Count")
|
55 |
+
adv_button = gr.Button("Submit")
|
56 |
|
57 |
+
with gr.Column(scale=2):
|
58 |
+
adv_output_image = gr.Gallery()
|
59 |
|
60 |
|
61 |
+
@adv_button.click(inputs=[adv_input_image, adv_image_count], outputs=[adv_output_image])
|
62 |
async def find_similar_faces(image, count):
|
63 |
inputs = extractor(images=image, return_tensors="pt")
|
64 |
outputs = model(**inputs)
|
|
|
68 |
)
|
69 |
return [dataset["train"][int(vector.id)]["image"] for vector in result]
|
70 |
|
71 |
+
|
72 |
+
adv_input_image.upload(fn=find_similar_faces, inputs=[adv_input_image, adv_image_count],
|
73 |
+
outputs=[adv_output_image])
|
74 |
+
|
75 |
if __name__ == "__main__":
|
76 |
+
demo.launch(debug=True, share=True)
|
requirements.txt
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
torchvision
|
2 |
transformers
|
3 |
datasets
|
4 |
upstash-vector
|
|
|
|
|
1 |
transformers
|
2 |
datasets
|
3 |
upstash-vector
|