Spaces:
Sleeping
Sleeping
return object data
Browse files
app.py
CHANGED
|
@@ -166,9 +166,9 @@ from pathlib import Path
|
|
| 166 |
# Function to visualize the model
|
| 167 |
def visualize_model(model_file):
|
| 168 |
# Save the uploaded file
|
| 169 |
-
file_path =
|
| 170 |
with open(file_path, "wb") as f:
|
| 171 |
-
f.write(model_file.read()
|
| 172 |
|
| 173 |
# Start Netron server to serve the file
|
| 174 |
port = 8081
|
|
@@ -195,5 +195,5 @@ demo = gr.Interface(
|
|
| 195 |
description="Upload a model file to visualize its architecture using Netron.",
|
| 196 |
)
|
| 197 |
|
| 198 |
-
# Launch the app
|
| 199 |
-
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 166 |
# Function to visualize the model
|
| 167 |
def visualize_model(model_file):
|
| 168 |
# Save the uploaded file
|
| 169 |
+
file_path = f"./models/{model_file.name}"
|
| 170 |
with open(file_path, "wb") as f:
|
| 171 |
+
f.write(model_file.data) # FIXED: Use 'data' instead of 'read()'
|
| 172 |
|
| 173 |
# Start Netron server to serve the file
|
| 174 |
port = 8081
|
|
|
|
| 195 |
description="Upload a model file to visualize its architecture using Netron.",
|
| 196 |
)
|
| 197 |
|
| 198 |
+
# Launch the app with public link support
|
| 199 |
+
demo.launch(server_name="0.0.0.0", server_port=7860, share=True)
|