Skip to content

Commit

Permalink
fix: remove cad_builder.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Yazan Amer committed Feb 6, 2024
1 parent 6f20891 commit 38c7ab7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 54 deletions.
8 changes: 1 addition & 7 deletions src/mcd_clip/bike_rendering/bikeCad_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import uuid
from asyncio import subprocess

from mcd_clip.bike_rendering.cad_builder import BikeCadFileBuilder
from mcd_clip.resource_utils import resource_path

TEMP_DIR = "bikes"
Expand All @@ -21,17 +20,12 @@


class RenderingService:
def __init__(self, renderer_pool_size, cad_builder=BikeCadFileBuilder()):
def __init__(self, renderer_pool_size):
os.makedirs(os.path.join(os.path.dirname(__file__), TEMP_DIR), exist_ok=True)
self._renderer_pool = queue.Queue(maxsize=renderer_pool_size)
self.cad_builder = cad_builder
for i in range(renderer_pool_size):
self._renderer_pool.put(BikeCad())

def render_object(self, bike_object, seed_bike_id):
return self.render(self.cad_builder.build_cad_from_object(bike_object,
seed_bike_id))

def render(self, bike_xml):
renderer = self._get_renderer()
result = renderer.render(bike_xml)
Expand Down
45 changes: 0 additions & 45 deletions src/mcd_clip/bike_rendering/cad_builder.py

This file was deleted.

4 changes: 2 additions & 2 deletions src/mcd_clip/e2e_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def run_counterfactual_generation_task(target_bike_description,

if __name__ == "__main__":
run_counterfactual_generation_task(
"A yellow bicycle with curved handles",
300,
"A yellow mountain bike",
450,
3
)
3 changes: 3 additions & 0 deletions test/test_rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ def test_rendering(self):
rendering_result = ParametricToImageConvertor().to_image(data.iloc[0])
self.assertTrue(type(rendering_result.bike_xml) is str)
self.assertTrue(type(rendering_result.image) is bytes)

def test_one_hot_encoded(self):
pass

0 comments on commit 38c7ab7

Please sign in to comment.