Update app.py
Browse files
app.py
CHANGED
|
@@ -14,56 +14,108 @@ def app():
|
|
| 14 |
}}
|
| 15 |
.gr-row {{
|
| 16 |
display: flex;
|
| 17 |
-
justify-content:
|
| 18 |
align-items: center;
|
| 19 |
}}
|
| 20 |
.gr-column {{
|
|
|
|
|
|
|
|
|
|
| 21 |
padding: 0 !important;
|
| 22 |
margin: 0 !important;
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
}}
|
| 26 |
""") as demo:
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
gr.Markdown("### Authors:")
|
| 30 |
|
|
|
|
| 31 |
with gr.Row():
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
gr.Markdown("
|
| 35 |
-
gr.
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
#with gr.Column():
|
| 39 |
-
#gr.Markdown("*Department of Physics, Universidad del Cauca ")
|
| 40 |
-
#gr.Markdown("~Department of Computer Engineer, Universidad Industrial de Santander ")
|
| 41 |
-
|
| 42 |
-
# Agregar la funcionalidad original de im谩genes y controles
|
| 43 |
-
with gr.Row():
|
| 44 |
with gr.Column():
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
image_size = gr.Slider(label="Image Size", minimum=320, maximum=1280, step=32, value=640)
|
| 48 |
-
conf_threshold = gr.Slider(label="Confidence Threshold", minimum=0.0, maximum=1.0, step=0.01, value=0.85)
|
| 49 |
-
correction = gr.Slider(label="Correction Factor", minimum=0, maximum=1.0, step=0.1, value=1.0)
|
| 50 |
-
sat_factor = gr.Slider(label="Saturation Factor", minimum=1.0, maximum=5.0, step=0.1, value=2.0)
|
| 51 |
-
kernel_size = gr.Slider(label="Blur Kernel Size", minimum=1, maximum=7, step=1, value=7)
|
| 52 |
-
DO = gr.Radio(label="DO", choices=["1", "2"], value="1")
|
| 53 |
-
t = gr.Slider(label="t", minimum=0.0, maximum=1.0, step=0.1, value=0.5)
|
| 54 |
-
vertical = gr.Radio(label="Vertical", choices=["True", "False"], value="True")
|
| 55 |
-
process_button = gr.Button("Process Image")
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
with gr.Column():
|
| 58 |
output_original = gr.Image(label="Original + blur")
|
| 59 |
-
output_clip = gr.Image(label="Clipped
|
|
|
|
| 60 |
output_wrap = gr.Image(label="Wrapped")
|
| 61 |
output_recons = gr.Image(label="Reconstructed")
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
return demo
|
| 67 |
|
|
|
|
| 68 |
if __name__ == "__main__":
|
| 69 |
app().launch()
|
|
|
|
| 14 |
}}
|
| 15 |
.gr-row {{
|
| 16 |
display: flex;
|
| 17 |
+
justify-content: center;
|
| 18 |
align-items: center;
|
| 19 |
}}
|
| 20 |
.gr-column {{
|
| 21 |
+
display: flex;
|
| 22 |
+
flex-direction: column;
|
| 23 |
+
align-items: center; /* Centramos todo en la columna */
|
| 24 |
padding: 0 !important;
|
| 25 |
margin: 0 !important;
|
| 26 |
+
}}
|
| 27 |
+
#centered-title {{
|
| 28 |
+
text-align: center;
|
| 29 |
+
}}
|
| 30 |
+
#centered-text {{
|
| 31 |
+
text-align: center;
|
| 32 |
+
margin-bottom: 10px;
|
| 33 |
+
}}
|
| 34 |
+
.custom-button {{
|
| 35 |
+
display: inline-block;
|
| 36 |
+
padding: 10px 20px;
|
| 37 |
+
font-size: 16px;
|
| 38 |
+
font-weight: bold;
|
| 39 |
+
color: white;
|
| 40 |
+
border-radius: 5px;
|
| 41 |
+
margin: 10px;
|
| 42 |
+
text-decoration: none;
|
| 43 |
+
text-align: center;
|
| 44 |
+
}}
|
| 45 |
+
.btn-grey {{
|
| 46 |
+
background-color: #4b4b4b;
|
| 47 |
+
}}
|
| 48 |
+
.btn-red {{
|
| 49 |
+
background-color: #e94e42;
|
| 50 |
}}
|
| 51 |
""") as demo:
|
| 52 |
+
# T铆tulo completamente centrado
|
| 53 |
+
gr.Markdown("## Modulo Imaging for Computer Vision", elem_id="centered-title")
|
|
|
|
| 54 |
|
| 55 |
+
# Organizar los art铆culos en dos columnas con botones centrados bajo el t铆tulo
|
| 56 |
with gr.Row():
|
| 57 |
+
# Primer art铆culo con su bot贸n centrado en su columna
|
| 58 |
+
with gr.Column():
|
| 59 |
+
gr.Markdown("### High Dynamic Range Modulo Imaging for Robust Object Detection in Autonomous Driving", elem_id="centered-text")
|
| 60 |
+
gr.HTML('<a href="https://openreview.net/pdf?id=2GqZFx2I7s" target="_blank" class="custom-button btn-grey">Article</a>')
|
| 61 |
+
|
| 62 |
+
# Segundo art铆culo con su bot贸n centrado en su columna
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
with gr.Column():
|
| 64 |
+
gr.Markdown("### Autoregressive High-Order Finite Difference Modulo Imaging: High-Dynamic Range for Computer Vision Applications", elem_id="centered-text")
|
| 65 |
+
gr.HTML('<a href="https://cvlai.net/aim/2024/" target="_blank" class="custom-button btn-red">Article</a>')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
+
# Ajustes de sliders y controles eliminados, valores fijos
|
| 68 |
+
image = gr.Image(type="pil", label="Upload Image")
|
| 69 |
+
model_id = gr.Dropdown(label="Model", choices=["yolov10n", "yolov10s", "yolov10m", "yolov10b", "yolov10l", "yolov10x"], value="yolov10x")
|
| 70 |
+
|
| 71 |
+
# Valores fijos
|
| 72 |
+
conf_threshold = 0.85
|
| 73 |
+
correction = 1.0
|
| 74 |
+
kernel_size = 7
|
| 75 |
+
DO = "1"
|
| 76 |
+
t = 0.7
|
| 77 |
+
vertical = "True"
|
| 78 |
+
|
| 79 |
+
# Mantener el control del nivel de saturaci贸n
|
| 80 |
+
sat_factor = gr.Slider(label="Saturation Factor", minimum=1.0, maximum=5.0, step=0.1, value=2.0)
|
| 81 |
+
|
| 82 |
+
process_button = gr.Button("Process Image")
|
| 83 |
+
|
| 84 |
+
# Mostrar las im谩genes en dos columnas, dos im谩genes por columna
|
| 85 |
+
with gr.Row():
|
| 86 |
with gr.Column():
|
| 87 |
output_original = gr.Image(label="Original + blur")
|
| 88 |
+
output_clip = gr.Image(label="Clipped")
|
| 89 |
+
with gr.Column():
|
| 90 |
output_wrap = gr.Image(label="Wrapped")
|
| 91 |
output_recons = gr.Image(label="Reconstructed")
|
| 92 |
+
|
| 93 |
+
# A帽adir bot贸n que despliega c贸mo citar el art铆culo en formato BibTeX
|
| 94 |
+
def show_bibtex_citation():
|
| 95 |
+
bibtex_citation = '''@inproceedings{contreras2024modulo,
|
| 96 |
+
title={High Dynamic Range Modulo Imaging for Robust Object Detection in Autonomous Driving},
|
| 97 |
+
author={Contreras, Kebin and Monroy, Brayan and Bacca, Jorge},
|
| 98 |
+
booktitle={Autonomous Driving Conference},
|
| 99 |
+
year={2024},
|
| 100 |
+
address={Bucaramanga, Colombia},
|
| 101 |
+
publisher={Universidad Industrial de Santander}
|
| 102 |
+
}'''
|
| 103 |
+
return bibtex_citation
|
| 104 |
+
|
| 105 |
+
# A帽adir bot贸n para copiar el texto
|
| 106 |
+
citation_button = gr.Button("How to Cite this Article (BibTeX)")
|
| 107 |
+
citation_text = gr.Textbox(visible=False, label="BibTeX Citation", interactive=False)
|
| 108 |
+
copy_button = gr.Button("Copy Citation", visible=False)
|
| 109 |
+
|
| 110 |
+
# Mostrar la cita en formato BibTeX y habilitar bot贸n de copiar
|
| 111 |
+
def copy_citation(citation):
|
| 112 |
+
return gr.update(visible=True), citation
|
| 113 |
+
|
| 114 |
+
citation_button.click(show_bibtex_citation, outputs=[citation_text])
|
| 115 |
+
copy_button.click(lambda x: x, inputs=citation_text, outputs=citation_text)
|
| 116 |
|
| 117 |
return demo
|
| 118 |
|
| 119 |
+
|
| 120 |
if __name__ == "__main__":
|
| 121 |
app().launch()
|