Skip to content

Commit

Permalink
Fix all obvious bugs found by mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
iurisilvio committed Jun 22, 2024
1 parent e27fcde commit 7f78966
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions roboflow/core/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ def version(self, version_number: int, local: str = None):
local=None,
workspace="",
project="",
public=True,
)

version_info = self.get_version_information()
Expand Down
8 changes: 4 additions & 4 deletions roboflow/core/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best
import ultralytics

except ImportError:
raise (
raise RuntimeError(
"The ultralytics python package is required to deploy yolov8"
" models. Please install it with `pip install ultralytics`"
)
Expand All @@ -465,7 +465,7 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best
import ultralytics

except ImportError:
raise (
raise RuntimeError(
"The ultralytics python package is required to deploy yolov10"
" models. Please install it with `pip install ultralytics`"
)
Expand All @@ -474,7 +474,7 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best
try:
import torch
except ImportError:
raise (
raise RuntimeError(
"The torch python package is required to deploy yolov5 models."
" Please install it with `pip install torch`"
)
Expand Down Expand Up @@ -619,7 +619,7 @@ def deploy_yolonas(self, model_type: str, model_path: str, filename: str = "weig
try:
import torch
except ImportError:
raise (
raise RuntimeError(
"The torch python package is required to deploy yolonas models."
" Please install it with `pip install torch`"
)
Expand Down
2 changes: 1 addition & 1 deletion roboflow/core/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def clip_compare(self, dir: str = "", image_ext: str = ".png", target_image: str
# grab all images in a given directory with ext type
for image in glob.glob(f"./{dir}/*{image_ext}"):
# compare image
similarity = clip_encode(image, target_image)
similarity = clip_encode(image, target_image, CLIP_FEATURIZE_URL)
# map image name to similarity score
comparisons.append({image: similarity})
comparisons = sorted(comparisons, key=lambda item: -list(item.values())[0])
Expand Down
8 changes: 4 additions & 4 deletions roboflow/models/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def predict(
>>> prediction = model.predict("video.mp4", fps=5, inference_type="object-detection")
""" # noqa: E501 // docs

url = urljoin(API_URL, "/video_upload_signed_url/?api_key=", self.__api_key)
url = urljoin(API_URL, f"/video_upload_signed_url/?api_key={self.__api_key}")

if fps > 30:
raise Exception("FPS must be less than or equal to 30.")
Expand Down Expand Up @@ -115,7 +115,7 @@ def predict(

print("Uploaded video to signed url: " + signed_url)

url = urljoin(API_URL, "/videoinfer/?api_key=", self.__api_key)
url = urljoin(API_URL, f"/videoinfer/?api_key={self.__api_key}")

models = [
{
Expand Down Expand Up @@ -162,7 +162,7 @@ def poll_for_results(self, job_id: str = None) -> dict:
if job_id is None:
job_id = self.job_id

url = urljoin(API_URL, "/videoinfer/?api_key=", self.__api_key, "&job_id=", self.job_id)
url = urljoin(API_URL, f"/videoinfer/?api_key={self.__api_key}&job_id={self.job_id}")

try:
response = requests.get(url, headers={"Content-Type": "application/json"})
Expand Down Expand Up @@ -216,7 +216,7 @@ def poll_until_results(self, job_id) -> dict:
attempts = 0

while True:
response = self.poll_for_response()
response = self.poll_for_results()

attempts += 1

Expand Down

0 comments on commit 7f78966

Please sign in to comment.