Skip to content

Commit b4ab623

Browse files
authored
Merge pull request #143 from web-genie-ai/hotfix/v-issue
Hotfix/v issue
2 parents c0cc56f + b3336f3 commit b4ab623

File tree

3 files changed

+1
-42
lines changed

3 files changed

+1
-42
lines changed

webgenie/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import psutil
44
# Change this value when updating your code base.
55
# Define the version of the webgenie.
6-
__VERSION__ = "1.2.0" # version
6+
__VERSION__ = "1.2.1" # version
77

88
SPEC_VERSION = (
99
(1000 * int(__VERSION__.split(".")[0]))

webgenie/datasets/central_dataset.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ class CentralDataset(Dataset):
1414

1515
def __init__(self):
1616
pass
17-
18-
async def generate_context(self) -> DatasetEntry:
19-
pass
2017

2118
async def generate_context(self, **kwargs)->DatasetEntry:
2219
try:

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)