Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -159,13 +159,14 @@ if __name__ == "__main__":
|
|
159 |
interface.launch(share=True)
|
160 |
"""
|
161 |
|
|
|
162 |
import gradio as gr
|
163 |
import torch
|
164 |
from ultralytics import YOLO
|
165 |
import os
|
166 |
|
167 |
# Assuming the YOLOv5 model is located in the same directory as this script
|
168 |
-
model_path = os.path.join(os.getcwd(), "weight_files/yolov5.onnx")
|
169 |
|
170 |
def visualize_yolov5():
|
171 |
"""
|
@@ -176,7 +177,7 @@ def visualize_yolov5():
|
|
176 |
model = YOLO(model_path)
|
177 |
|
178 |
# Extract the PyTorch model
|
179 |
-
pytorch_model = model.model
|
180 |
|
181 |
# Save the PyTorch model to a temporary file
|
182 |
temp_model_path = "temp_model"
|
@@ -197,5 +198,5 @@ iface = gr.Interface(
|
|
197 |
description="Visualize the YOLOv5 model."
|
198 |
)
|
199 |
|
200 |
-
# Launch the Gradio app
|
201 |
iface.launch(share=True)
|
|
|
159 |
interface.launch(share=True)
|
160 |
"""
|
161 |
|
162 |
+
|
163 |
import gradio as gr
|
164 |
import torch
|
165 |
from ultralytics import YOLO
|
166 |
import os
|
167 |
|
168 |
# Assuming the YOLOv5 model is located in the same directory as this script
|
169 |
+
model_path = os.path.join(os.getcwd(), "weight_files/yolov5.onnx") # Replace with the actual model directory name
|
170 |
|
171 |
def visualize_yolov5():
|
172 |
"""
|
|
|
177 |
model = YOLO(model_path)
|
178 |
|
179 |
# Extract the PyTorch model
|
180 |
+
pytorch_model = model.model
|
181 |
|
182 |
# Save the PyTorch model to a temporary file
|
183 |
temp_model_path = "temp_model"
|
|
|
198 |
description="Visualize the YOLOv5 model."
|
199 |
)
|
200 |
|
201 |
+
# Launch the Gradio app with public link
|
202 |
iface.launch(share=True)
|