Skip to content

Commit d3cded8

Browse files
committed
chore: remove conflict func
1 parent 188bc76 commit d3cded8

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

webgenie/tasks/image_task_generator.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -82,44 +82,6 @@ async def generate_task(self, **kwargs) -> Tuple[Task, bt.Synapse]:
8282
timeout=IMAGE_TASK_TIMEOUT,
8383
)
8484

85-
return (
86-
image_task,
87-
WebgenieImageSynapse(base64_image=base64_image, task_id=image_task.task_id),
88-
)
89-
90-
async def generate_task(self, session:int, task_number:int)->Tuple[Task, bt.Synapse]:
91-
bt.logging.info("Generating Image task")
92-
93-
dataset, _ = random.choices(self.datasets, weights=[weight for _, weight in self.datasets])[0]
94-
dataset_entry = await dataset.generate_context(session, task_number)
95-
bt.logging.debug(f"Generated dataset entry: {dataset_entry.url}")
96-
97-
ground_truth_html = preprocess_html(dataset_entry.ground_truth_html)
98-
bt.logging.info(f"Preprocessed ground truth html")
99-
if not ground_truth_html :
100-
raise ValueError("Invalid ground truth html")
101-
102-
if is_empty_html(ground_truth_html):
103-
raise ValueError("Empty ground truth html")
104-
105-
base64_image = await html_to_screenshot(ground_truth_html, page_load_time=GROUND_TRUTH_HTML_LOAD_TIME)
106-
# Check image dimensions ratio
107-
image = base64_to_image(base64_image)
108-
width, height = image.size
109-
aspect_ratio = height / width
110-
if aspect_ratio > 7: # If height is more than 7x the width
111-
raise ValueError(f"Image aspect ratio too extreme: {aspect_ratio:.2f}. Height should not exceed 7x width.")
112-
113-
bt.logging.debug(f"Screenshot generated for {dataset_entry.url}")
114-
image_task = ImageTask(
115-
base64_image=base64_image,
116-
ground_truth_html=ground_truth_html,
117-
generator=self,
118-
src=dataset_entry.src,
119-
task_id=hashlib.sha256(dataset_entry.url.encode()).hexdigest(),
120-
timeout=IMAGE_TASK_TIMEOUT,
121-
)
122-
12385
return (
12486
image_task,
12587
WebgenieImageSynapse(base64_image=base64_image, task_id=image_task.task_id),

0 commit comments

Comments
 (0)