Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ from PIL import Image, ImageDraw
|
|
5 |
import cv2
|
6 |
import numpy as np
|
7 |
from selenium import webdriver
|
|
|
8 |
from selenium.webdriver.common.by import By
|
9 |
from selenium.webdriver.support.ui import WebDriverWait
|
10 |
from selenium.webdriver.support import expected_conditions as EC
|
@@ -26,10 +27,22 @@ ROBOFLOW_API_KEY = "KUP9w62eUcD5PrrRMJsV" # Replace with your API key
|
|
26 |
PROJECT_NAME = "model_verification_project"
|
27 |
VERSION_NUMBER = 2
|
28 |
|
|
|
|
|
|
|
|
|
29 |
# Selenium configuration for Calligrapher
|
30 |
def get_calligrapher():
|
31 |
calli_url = "https://www.calligrapher.ai"
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
driver.maximize_window()
|
34 |
driver.get(calli_url)
|
35 |
|
@@ -179,3 +192,4 @@ if __name__ == "__main__":
|
|
179 |
logging.debug("Launching Gradio interface.")
|
180 |
interface.launch(share=True)
|
181 |
|
|
|
|
5 |
import cv2
|
6 |
import numpy as np
|
7 |
from selenium import webdriver
|
8 |
+
from selenium.webdriver.chrome.service import Service
|
9 |
from selenium.webdriver.common.by import By
|
10 |
from selenium.webdriver.support.ui import WebDriverWait
|
11 |
from selenium.webdriver.support import expected_conditions as EC
|
|
|
27 |
PROJECT_NAME = "model_verification_project"
|
28 |
VERSION_NUMBER = 2
|
29 |
|
30 |
+
# Paths to Chrome and ChromeDriver downloaded by Selenium Manager
|
31 |
+
CHROME_PATH = "/home/user/.cache/selenium/chrome/linux64/132.0.6834.83/chrome"
|
32 |
+
CHROMEDRIVER_PATH = "/home/user/.cache/selenium/chromedriver/linux64/132.0.6834.83/chromedriver"
|
33 |
+
|
34 |
# Selenium configuration for Calligrapher
|
35 |
def get_calligrapher():
|
36 |
calli_url = "https://www.calligrapher.ai"
|
37 |
+
|
38 |
+
options = webdriver.ChromeOptions()
|
39 |
+
options.add_argument("--headless") # Run Chrome in headless mode
|
40 |
+
options.add_argument("--no-sandbox")
|
41 |
+
options.add_argument("--disable-dev-shm-usage")
|
42 |
+
options.binary_location = CHROME_PATH
|
43 |
+
|
44 |
+
service = Service(CHROMEDRIVER_PATH)
|
45 |
+
driver = webdriver.Chrome(service=service, options=options)
|
46 |
driver.maximize_window()
|
47 |
driver.get(calli_url)
|
48 |
|
|
|
192 |
logging.debug("Launching Gradio interface.")
|
193 |
interface.launch(share=True)
|
194 |
|
195 |
+
|