Spaces:
Sleeping
Sleeping
removed upload model support
Browse files
app.py
CHANGED
|
@@ -45,9 +45,9 @@ def process_image(sample_choice, uploaded_image, yolo_versions):
|
|
| 45 |
return result_images
|
| 46 |
|
| 47 |
def view_model(selected_models):
|
| 48 |
-
for
|
|
|
|
| 49 |
if model == "yolov5":
|
| 50 |
-
# Embed the Netron viewer using an iframe with the generated URL
|
| 51 |
iframe_html = f"""
|
| 52 |
<iframe
|
| 53 |
src="https://netron.app/?url=https://huggingface.co/FFusion/FFusionXL-BASE/blob/main/vae_encoder/model.onnx"
|
|
@@ -115,24 +115,23 @@ with gr.Blocks(css=custom_css) as interface:
|
|
| 115 |
|
| 116 |
netron_display = gr.HTML(label="Netron Visualization")
|
| 117 |
|
|
|
|
| 118 |
sample_selection.change(
|
| 119 |
fn=load_sample_image,
|
| 120 |
inputs=sample_selection,
|
| 121 |
outputs=sample_display,
|
| 122 |
)
|
| 123 |
|
|
|
|
| 124 |
run_button.click(
|
| 125 |
-
fn=
|
|
|
|
|
|
|
|
|
|
| 126 |
inputs=[sample_selection, upload_image, selected_models],
|
| 127 |
-
outputs=[result_gallery],
|
| 128 |
)
|
| 129 |
|
| 130 |
-
|
| 131 |
-
fn=view_model,
|
| 132 |
-
inputs=selected_models,
|
| 133 |
-
outputs=netron_display,
|
| 134 |
-
)
|
| 135 |
-
|
| 136 |
-
# Launching Gradio app and handling Netron visualization separately.
|
| 137 |
if __name__ == "__main__":
|
| 138 |
interface.launch(share=True)
|
|
|
|
| 45 |
return result_images
|
| 46 |
|
| 47 |
def view_model(selected_models):
|
| 48 |
+
"""Generate Netron visualization for the selected models."""
|
| 49 |
+
for model in selected_models:
|
| 50 |
if model == "yolov5":
|
|
|
|
| 51 |
iframe_html = f"""
|
| 52 |
<iframe
|
| 53 |
src="https://netron.app/?url=https://huggingface.co/FFusion/FFusionXL-BASE/blob/main/vae_encoder/model.onnx"
|
|
|
|
| 115 |
|
| 116 |
netron_display = gr.HTML(label="Netron Visualization")
|
| 117 |
|
| 118 |
+
# Update the sample image when the sample is changed
|
| 119 |
sample_selection.change(
|
| 120 |
fn=load_sample_image,
|
| 121 |
inputs=sample_selection,
|
| 122 |
outputs=sample_display,
|
| 123 |
)
|
| 124 |
|
| 125 |
+
# Process image and display results, also trigger Netron visualization when run button is clicked
|
| 126 |
run_button.click(
|
| 127 |
+
fn=lambda sample_choice, uploaded_image, yolo_versions: [
|
| 128 |
+
process_image(sample_choice, uploaded_image, yolo_versions), # Process image
|
| 129 |
+
view_model(yolo_versions) # Display model visualization
|
| 130 |
+
],
|
| 131 |
inputs=[sample_selection, upload_image, selected_models],
|
| 132 |
+
outputs=[result_gallery, netron_display],
|
| 133 |
)
|
| 134 |
|
| 135 |
+
# Launching Gradio app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
if __name__ == "__main__":
|
| 137 |
interface.launch(share=True)
|