Simon commited on
Commit
8217c57
·
1 Parent(s): badc90c

change UI to two seperate visual evidence parts

Browse files
Files changed (1) hide show
  1. app.py +18 -4
app.py CHANGED
@@ -191,19 +191,32 @@ with gr.Blocks() as demo:
191
 
192
  btn_analyze = gr.Button("Analyze Similarity", variant="primary")
193
 
194
- gr.Markdown("### Assessment Metrics")
 
 
 
 
 
 
 
 
195
  with gr.Row():
196
  score_semantic = gr.Number(label="Semantic Match (CLIP) - Idea", show_label=True)
197
  score_struct = gr.Number(label="Structural Match (Edge IoU) - Layout", show_label=True)
198
  score_patch = gr.Number(label="Patch Match (DINOv2) - Fragmented Literal", show_label=True)
199
 
200
  gr.Markdown("### Visual Evidence")
201
- with gr.Tabs():
202
- with gr.TabItem("Fragmented Literal Similarity (DINOv2)"):
 
 
 
203
  gr.Markdown("**Red boxes and green lines indicate mutually correlating local patches (Similarity > 0.85)**")
204
  vis_patch = gr.Image(label="Patch Mapping Visualization", type="pil")
205
 
206
- with gr.TabItem("Substantial Similarity (Edge Detection)"):
 
 
207
  with gr.Row():
208
  vis_edge_a = gr.Image(label="Image A Edges", type="pil")
209
  vis_edge_b = gr.Image(label="Image B Edges", type="pil")
@@ -222,4 +235,5 @@ with gr.Blocks() as demo:
222
  )
223
 
224
  if __name__ == "__main__":
 
225
  demo.launch(theme=gr.themes.Soft())
 
191
 
192
  btn_analyze = gr.Button("Analyze Similarity", variant="primary")
193
 
194
+ gr.Markdown("### Assessment Metrics & Legal Context")
195
+
196
+ # Context pulled directly from the paper
197
+ gr.Markdown("""
198
+ * **Semantic Match (Idea-Expression Dichotomy):** Evaluates if works share an underlying conceptual basis. Models like CLIP link visual data to semantic concepts to bridge the "semantic gap"[cite: 1]. This acts as an initial threshold, as copyright protects concrete expression rather than mere abstract ideas[cite: 1].
199
+ * **Structural Match (Substantial Similarity):** Detects structural relationships through spatial mapping[cite: 1]. This addresses how the specific combination and arrangement of individual elements can form part of the protected expression[cite: 1].
200
+ * **Patch Match (Fragmented Literal Similarity):** Identifies "scattered literal copying" where specific fragments of a protected work are reproduced directly or in a highly proximate manner, without the new work as a whole having to resemble the original[cite: 1]. Localized patch-based matching algorithms divide the image to detect these copied fragments regardless of where they are placed in the new works[cite: 1].
201
+ """)
202
+
203
  with gr.Row():
204
  score_semantic = gr.Number(label="Semantic Match (CLIP) - Idea", show_label=True)
205
  score_struct = gr.Number(label="Structural Match (Edge IoU) - Layout", show_label=True)
206
  score_patch = gr.Number(label="Patch Match (DINOv2) - Fragmented Literal", show_label=True)
207
 
208
  gr.Markdown("### Visual Evidence")
209
+
210
+ # Replaced Tabs with a Row containing two Columns for side-by-side display
211
+ with gr.Row():
212
+ with gr.Column():
213
+ gr.Markdown("#### Fragmented Literal Similarity (DINOv2)")
214
  gr.Markdown("**Red boxes and green lines indicate mutually correlating local patches (Similarity > 0.85)**")
215
  vis_patch = gr.Image(label="Patch Mapping Visualization", type="pil")
216
 
217
+ with gr.Column():
218
+ gr.Markdown("#### Substantial Similarity (Edge Detection)")
219
+ gr.Markdown("**Comparison of spatial arrangements and structural boundaries.**")
220
  with gr.Row():
221
  vis_edge_a = gr.Image(label="Image A Edges", type="pil")
222
  vis_edge_b = gr.Image(label="Image B Edges", type="pil")
 
235
  )
236
 
237
  if __name__ == "__main__":
238
+ # Remember to keep your theme in the launch method if you are using Gradio 6.0!
239
  demo.launch(theme=gr.themes.Soft())