Plat commited on
Commit
6ecba54
·
1 Parent(s): 3e0e479

feat: examples

Browse files
app.py CHANGED
@@ -69,18 +69,30 @@ def calculate_similarity(model_name: str, image_1: Image.Image, image_2: Image.I
69
 
70
  with gr.Blocks() as demo:
71
  with gr.Row():
72
- with gr.Column():
73
- image_1 = gr.Image(label="Image 1", type="pil")
74
- image_2 = gr.Image(label="Image 2", type="pil")
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
 
76
  model_name = gr.Dropdown(
77
  label="Model",
78
  choices=list(MODELS.keys()),
79
  value=list(MODELS.keys())[0],
80
  )
81
  submit_btn = gr.Button("Submit", variant="primary")
82
-
83
- with gr.Column():
84
  similarity = gr.Label(label="Similarity")
85
 
86
  gr.on(
 
69
 
70
  with gr.Blocks() as demo:
71
  with gr.Row():
72
+ with gr.Column(scale=2):
73
+ with gr.Row():
74
+ image_1 = gr.Image(label="Image 1", type="pil")
75
+
76
+ image_2 = gr.Image(label="Image 2", type="pil")
77
+
78
+ gr.Examples(
79
+ examples=[
80
+ ["./examples/sample_01.jpg", "./examples/sample_02.jpg"],
81
+ ["./examples/sample_01.jpg", "./examples/sample_05.jpg"],
82
+ ["./examples/sample_01.jpg", "./examples/sample_06.jpg"],
83
+ ["./examples/sample_01.jpg", "./examples/sample_03.jpg"],
84
+ ["./examples/sample_04.jpg", "./examples/sample_03.jpg"],
85
+ ],
86
+ inputs=[image_1, image_2],
87
+ )
88
 
89
+ with gr.Column():
90
  model_name = gr.Dropdown(
91
  label="Model",
92
  choices=list(MODELS.keys()),
93
  value=list(MODELS.keys())[0],
94
  )
95
  submit_btn = gr.Button("Submit", variant="primary")
 
 
96
  similarity = gr.Label(label="Similarity")
97
 
98
  gr.on(
examples/sample_01.jpg ADDED
examples/sample_02.jpg ADDED
examples/sample_03.jpg ADDED
examples/sample_04.jpg ADDED
examples/sample_05.jpg ADDED
examples/sample_06.jpg ADDED