Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

Update return type of generate_ad_image method

avocardioc6a47dbf7019
diff --git a/examples/apps/ad-use/ad_generator.py b/examples/apps/ad-use/ad_generator.py
index 0d3391fa4..b6f8e84e4 100644
--- a/examples/apps/ad-use/ad_generator.py
+++ b/examples/apps/ad-use/ad_generator.py
@@ -6,7 +6,6 @@ import subprocess
import sys
from datetime import datetime
from pathlib import Path
-from typing import Optional
def setup_environment(debug: bool):
@@ -128,7 +127,7 @@ Create a vibrant, eye-catching Instagram ad image with:
Style: Modern Instagram advertisement, (1:1), scroll-stopping, professional but playful, conversion-focused"""
return prompt
- async def generate_ad_image(self, prompt: str, screenshot_path: Path | None = None) -> Optional[bytes]:
+ async def generate_ad_image(self, prompt: str, screenshot_path: Path | None = None) -> bytes | None:
"""Generate ad image bytes using Gemini. Returns None on failure."""
try: