Azzan Dwi Riski commited on
Commit
589504e
·
1 Parent(s): f9bdea7

fix issues

Browse files
Files changed (1) hide show
  1. app.py +11 -13
app.py CHANGED
@@ -67,6 +67,17 @@ transform = transforms.Compose([
67
  std=[0.229, 0.224, 0.225]),
68
  ])
69
 
 
 
 
 
 
 
 
 
 
 
 
70
  ensure_playwright_chromium()
71
 
72
  # Screenshot folder
@@ -162,19 +173,6 @@ def clean_text(text):
162
  return "" # empty return to use image-only
163
  return text
164
 
165
- # Jalankan ini sekali di awal startup aplikasi (misalnya di main file / sebelum model load)
166
- def ensure_playwright_chromium():
167
- try:
168
- print("Checking and installing Playwright Chromium if not present...")
169
- subprocess.run(["playwright", "install", "chromium"], check=True)
170
- print("Playwright Chromium installation completed.")
171
- except Exception as e:
172
- print("Error during Playwright Chromium installation:", e)
173
- traceback.print_exc()
174
-
175
- # Pastikan dipanggil saat startup (di luar fungsi screenshot)
176
- ensure_playwright_chromium()
177
-
178
  # Fungsi untuk mengambil screenshot viewport
179
  def take_screenshot(url):
180
  filename = url.replace('https://', '').replace('http://', '').replace('/', '_').replace('.', '_') + '.png'
 
67
  std=[0.229, 0.224, 0.225]),
68
  ])
69
 
70
+ # Jalankan ini sekali di awal startup aplikasi (misalnya di main file / sebelum model load)
71
+ def ensure_playwright_chromium():
72
+ try:
73
+ print("Checking and installing Playwright Chromium if not present...")
74
+ subprocess.run(["playwright", "install", "chromium"], check=True)
75
+ print("Playwright Chromium installation completed.")
76
+ except Exception as e:
77
+ print("Error during Playwright Chromium installation:", e)
78
+ traceback.print_exc()
79
+
80
+ # Pastikan dipanggil saat startup (di luar fungsi screenshot)
81
  ensure_playwright_chromium()
82
 
83
  # Screenshot folder
 
173
  return "" # empty return to use image-only
174
  return text
175
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  # Fungsi untuk mengambil screenshot viewport
177
  def take_screenshot(url):
178
  filename = url.replace('https://', '').replace('http://', '').replace('/', '_').replace('.', '_') + '.png'