Skip to content

Commit eebfee0

Browse files
committed
i had deleted the put
1 parent 996da6d commit eebfee0

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

roboflow/core/version.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def deploy(self, model_type: str, model_path: str) -> None:
316316
"The torch python package is required to deploy yolov5 models. Please install it with `pip install torch`"
317317
)
318318

319-
model = torch.load(model_path + "weights/best.pt")
319+
model = torch.load(os.path.join(model_path, "weights/best.pt"))
320320

321321
class_names = []
322322
for i, val in enumerate(model["model"].names):
@@ -355,7 +355,7 @@ def deploy(self, model_type: str, model_path: str) -> None:
355355
elif model_type == "yolov5":
356356
#parse from yaml for yolov5
357357

358-
with open(os.path.join(model_path + "opt.yaml"), "r") as stream:
358+
with open(os.path.join(model_path, "opt.yaml"), "r") as stream:
359359
opts = yaml.safe_load(stream)
360360

361361
model_artifacts = {
@@ -399,6 +399,29 @@ def deploy(self, model_type: str, model_path: str) -> None:
399399
except Exception as e:
400400
print(f"An error occured when getting the model upload URL: {e}")
401401
return
402+
403+
res = requests.put(
404+
res.json()["url"],
405+
data=open(os.path.join(model_path + "roboflow_deploy.zip", "rb")),
406+
)
407+
try:
408+
res.raise_for_status()
409+
410+
if self.public:
411+
print(
412+
f"View the status of your deployment at: {APP_URL}/{self.workspace}/{self.project}/deploy/{self.version}"
413+
)
414+
print(
415+
f"Share your model with the world at: {UNIVERSE_URL}/{self.workspace}/{self.project}/model/{self.version}"
416+
)
417+
else:
418+
print(
419+
f"View the status of your deployment at: {APP_URL}/{self.workspace}/{self.project}/deploy/{self.version}"
420+
)
421+
422+
except Exception as e:
423+
print(f"An error occured when uploading the model: {e}")
424+
402425

403426
def __download_zip(self, link, location, format):
404427
"""

0 commit comments

Comments
 (0)