Spaces:
Sleeping
Sleeping
update server port
Browse files
app.py
CHANGED
@@ -159,7 +159,6 @@ if __name__ == "__main__":
|
|
159 |
interface.launch(share=True)
|
160 |
"""
|
161 |
|
162 |
-
|
163 |
import gradio as gr
|
164 |
import netron
|
165 |
import os
|
@@ -177,11 +176,11 @@ def visualize_model(model_file):
|
|
177 |
f.write(model_file.encode()) # Use encode() to write the string content
|
178 |
model_path = temp_model_path
|
179 |
|
180 |
-
# Start Netron visualization in a separate thread
|
181 |
-
threading.Thread(target=netron.start, args=(model_path,)).start()
|
182 |
|
183 |
-
# Return an iframe embedding the Netron visualization
|
184 |
-
iframe_html = f'<iframe src="http://localhost:
|
185 |
return iframe_html
|
186 |
|
187 |
# Create the Gradio interface
|
@@ -192,6 +191,8 @@ interface = gr.Interface(
|
|
192 |
live=True
|
193 |
)
|
194 |
|
195 |
-
interface
|
|
|
|
|
196 |
|
197 |
|
|
|
159 |
interface.launch(share=True)
|
160 |
"""
|
161 |
|
|
|
162 |
import gradio as gr
|
163 |
import netron
|
164 |
import os
|
|
|
176 |
f.write(model_file.encode()) # Use encode() to write the string content
|
177 |
model_path = temp_model_path
|
178 |
|
179 |
+
# Start Netron visualization in a separate thread, specifying a custom port (e.g., 8081)
|
180 |
+
threading.Thread(target=netron.start, args=(model_path, 8081)).start()
|
181 |
|
182 |
+
# Return an iframe embedding the Netron visualization on the correct port
|
183 |
+
iframe_html = f'<iframe src="http://localhost:8081" width="800" height="600"></iframe>'
|
184 |
return iframe_html
|
185 |
|
186 |
# Create the Gradio interface
|
|
|
191 |
live=True
|
192 |
)
|
193 |
|
194 |
+
# Launch Gradio interface on localhost:7860
|
195 |
+
interface.launch(server_name="0.0.0.0", server_port=7860, share=True)
|
196 |
+
|
197 |
|
198 |
|