Spaces:
Running
Running
Update app/lens_text_core.py
Browse files- app/lens_text_core.py +3 -3
app/lens_text_core.py
CHANGED
|
@@ -33,9 +33,9 @@ CHROME_EXTRA_ARGS = os.getenv(
|
|
| 33 |
"--window-size=1920,1080 --headless=new",
|
| 34 |
).split()
|
| 35 |
|
| 36 |
-
_CACHE_TTL =
|
| 37 |
-
_IDLE_TIMEOUT = int(os.getenv("CHROME_IDLE_SECONDS", "60"))
|
| 38 |
_BROWSER_TTL = 900
|
|
|
|
| 39 |
|
| 40 |
def _mk_profile_dir() -> str:
|
| 41 |
base = tempfile.gettempdir()
|
|
@@ -228,7 +228,7 @@ def _parse_calc_value(calc: str, dim: float) -> float:
|
|
| 228 |
return base - off if op == "-" else base + off
|
| 229 |
|
| 230 |
def _extract_boxes(drv, w: int, h: int) -> List[Dict[str, Any]]:
|
| 231 |
-
WebDriverWait(drv,
|
| 232 |
nodes = drv.find_elements(By.XPATH, "//div[contains(@class,'lv6PAb') and @aria-label]")
|
| 233 |
|
| 234 |
out: List[Dict[str,Any]] = []
|
|
|
|
| 33 |
"--window-size=1920,1080 --headless=new",
|
| 34 |
).split()
|
| 35 |
|
| 36 |
+
_CACHE_TTL = 600
|
|
|
|
| 37 |
_BROWSER_TTL = 900
|
| 38 |
+
_IDLE_TIMEOUT = int(os.getenv("CHROME_IDLE_SECONDS", "60"))
|
| 39 |
|
| 40 |
def _mk_profile_dir() -> str:
|
| 41 |
base = tempfile.gettempdir()
|
|
|
|
| 228 |
return base - off if op == "-" else base + off
|
| 229 |
|
| 230 |
def _extract_boxes(drv, w: int, h: int) -> List[Dict[str, Any]]:
|
| 231 |
+
WebDriverWait(drv, 30).until(EC.visibility_of_element_located((By.CSS_SELECTOR, "div.lv6PAb")))
|
| 232 |
nodes = drv.find_elements(By.XPATH, "//div[contains(@class,'lv6PAb') and @aria-label]")
|
| 233 |
|
| 234 |
out: List[Dict[str,Any]] = []
|