Skip to content

Commit

Permalink
refactor(gui): optimize ImageGeneratorGUI class
Browse files Browse the repository at this point in the history
Remove unnecessary comments and adjust notification settings
  • Loading branch information
rtuszik committed Sep 3, 2024
1 parent 9ccc139 commit 1b2b013
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ def __init__(self, image_generator):
"replicate_model",
]

# Initialize attributes
for attr in self._attributes:
setattr(self, attr, None)

Expand Down Expand Up @@ -457,6 +456,7 @@ def check_api_key(self):
type="warning",
close_button="OK",
timeout=10000, # 10 seconds
position="top",
)

async def reset_to_default(self):
Expand Down Expand Up @@ -494,7 +494,6 @@ async def start_generation(self):
)
return

# Run set_model in a separate thread if it's a blocking operation
await asyncio.to_thread(
self.image_generator.set_model, self.replicate_model_select.value
)
Expand Down Expand Up @@ -526,7 +525,6 @@ async def start_generation(self):
logger.info(f"Generating images with params: {json.dumps(params, indent=2)}")

try:
# Assuming generate_images is also a blocking operation, we'll run it in a thread too
output = await asyncio.to_thread(
self.image_generator.generate_images, params
)
Expand Down

0 comments on commit 1b2b013

Please sign in to comment.