Spaces:
Sleeping
Sleeping
test endpoint deployment netron
Browse files
app.py
CHANGED
@@ -48,7 +48,7 @@ def process_image(sample_choice, uploaded_image, yolo_versions):
|
|
48 |
|
49 |
def start_netron_backend(model_file):
|
50 |
def serve_netron():
|
51 |
-
netron.start(model_file, port=8080) # Start Netron on port 8080
|
52 |
|
53 |
# Launch Netron in a separate thread
|
54 |
threading.Thread(target=serve_netron, daemon=True).start()
|
@@ -61,8 +61,7 @@ def view_netron_model():
|
|
61 |
|
62 |
# Start Netron backend
|
63 |
start_netron_backend(preloaded_model_file)
|
64 |
-
return '<iframe src="http://localhost:8080/" width="100%" height="600px"></iframe>'
|
65 |
-
|
66 |
|
67 |
# Custom CSS for styling (optional)
|
68 |
custom_css = """
|
@@ -118,7 +117,7 @@ with gr.Blocks(css=custom_css) as interface:
|
|
118 |
height=500,
|
119 |
)
|
120 |
|
121 |
-
netron_display = gr.HTML(label="Model Visualization")
|
122 |
|
123 |
# Sample selection update
|
124 |
sample_selection.change(
|
@@ -135,7 +134,8 @@ with gr.Blocks(css=custom_css) as interface:
|
|
135 |
)
|
136 |
|
137 |
# Netron model visualization
|
138 |
-
|
|
|
139 |
|
140 |
# Launch Gradio app
|
141 |
if __name__ == "__main__":
|
|
|
48 |
|
49 |
def start_netron_backend(model_file):
|
50 |
def serve_netron():
|
51 |
+
netron.start(model_file, host='0.0.0.0', port=8080) # Start Netron on port 8080
|
52 |
|
53 |
# Launch Netron in a separate thread
|
54 |
threading.Thread(target=serve_netron, daemon=True).start()
|
|
|
61 |
|
62 |
# Start Netron backend
|
63 |
start_netron_backend(preloaded_model_file)
|
64 |
+
return gr.HTML(f'<iframe src="http://localhost:8080/" width="100%" height="600px"></iframe>')
|
|
|
65 |
|
66 |
# Custom CSS for styling (optional)
|
67 |
custom_css = """
|
|
|
117 |
height=500,
|
118 |
)
|
119 |
|
120 |
+
# netron_display = gr.HTML(label="Model Visualization")
|
121 |
|
122 |
# Sample selection update
|
123 |
sample_selection.change(
|
|
|
134 |
)
|
135 |
|
136 |
# Netron model visualization
|
137 |
+
interface.add_component(gr.HTML(view_netron_model))
|
138 |
+
# netron_display.value = view_netron_model()
|
139 |
|
140 |
# Launch Gradio app
|
141 |
if __name__ == "__main__":
|