fecia commited on
Commit
a03be3c
·
verified ·
1 Parent(s): c8829c1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -3
app.py CHANGED
@@ -403,15 +403,34 @@ with gr.Blocks(css=css) as demo:
403
  # )
404
  with gr.Column(scale=2):
405
  output_label = gr.Label(label="Overall Quality Estimate", elem_id="quality-label")
406
- # ***** LÍNEA MODIFICADA: Se quitó height=350 *****
407
  output_dataframe = gr.DataFrame(
408
  headers=["Criterion", "Sim (+)", "Sim (-)", "Difference", "Assessment (Comp)", "Assessment (Simp)"],
409
  label="Detailed Quality Assessment",
410
- wrap=True
411
- # height=350 # <- Eliminado
412
  )
413
  output_json = gr.JSON(label="Raw Results (for debugging)")
414
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
415
  # --- Iniciar la Aplicación Gradio ---
416
  # Al desplegar en Spaces, Gradio se encarga de esto automáticamente.
417
  # Para ejecutar localmente: demo.launch()
 
403
  # )
404
  with gr.Column(scale=2):
405
  output_label = gr.Label(label="Overall Quality Estimate", elem_id="quality-label")
 
406
  output_dataframe = gr.DataFrame(
407
  headers=["Criterion", "Sim (+)", "Sim (-)", "Difference", "Assessment (Comp)", "Assessment (Simp)"],
408
  label="Detailed Quality Assessment",
409
+ wrap=True,
410
+ height=350
411
  )
412
  output_json = gr.JSON(label="Raw Results (for debugging)")
413
 
414
+
415
+ gr.Markdown(
416
+ f"""
417
+ **Explanation:**
418
+ * **Criterion:** The quality aspect being evaluated (using the positive prompt text).
419
+ * **Sim (+):** Cosine similarity between the image and the *positive* text prompt (e.g., "optimal centering"). Higher is better.
420
+ * **Sim (-):** Cosine similarity between the image and the *negative* text prompt (e.g., "poorly centered"). Lower is better.
421
+ * **Difference:** Sim (+) - Sim (-). A large positive difference indicates the image is much closer to the positive description.
422
+ * **Assessment (Comp):** PASS if Difference > {SIMILARITY_DIFFERENCE_THRESHOLD}, otherwise FAIL. This is the main comparative assessment.
423
+ * **Assessment (Simp):** PASS if Sim (+) > {POSITIVE_SIMILARITY_THRESHOLD}, otherwise FAIL. A simpler check based only on positive similarity.
424
+ """
425
+ )
426
+
427
+ # Conectar el botón a la función de procesamiento
428
+ submit_button.click(
429
+ fn=assess_quality,
430
+ inputs=input_image,
431
+ outputs=[output_dataframe, output_label, output_json]
432
+ )
433
+
434
  # --- Iniciar la Aplicación Gradio ---
435
  # Al desplegar en Spaces, Gradio se encarga de esto automáticamente.
436
  # Para ejecutar localmente: demo.launch()