ByFlown commited on
Commit
a0de170
·
verified ·
1 Parent(s): 3150af7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -7
app.py CHANGED
@@ -15,13 +15,32 @@ def log_versions():
15
  # Print PATH for debugging
16
  print(f"System PATH: {os.environ.get('PATH')}")
17
  # Try finding Chrome binary
18
- chrome_path = subprocess.check_output(["which", "google-chrome"]).decode().strip()
19
- print(f"Chrome binary found at: {chrome_path}")
20
- # Get versions
21
- chrome_version = subprocess.check_output(["google-chrome", "--version"]).decode().strip()
22
- chromedriver_version = subprocess.check_output(["chromedriver", "--version"]).decode().strip()
 
 
 
 
 
 
 
 
 
 
23
  print(f"Chrome version: {chrome_version}")
24
- print(f"ChromeDriver version: {chromedriver_version}")
 
 
 
 
 
 
 
 
 
25
  except Exception as e:
26
  print(f"Error checking versions: {str(e)}")
27
 
@@ -97,7 +116,7 @@ iface = gr.Interface(
97
  fn=gradio_interface,
98
  inputs=gr.Textbox(label="Enter your prompt", placeholder="e.g., A serene mountain landscape at sunset"),
99
  outputs=[gr.Textbox(label="Result"), gr.Image(label="Generated Image")],
100
- title="Image Generator with Selenium",
101
  description="Enter a prompt to generate an image using gptimage.ai."
102
  )
103
 
 
15
  # Print PATH for debugging
16
  print(f"System PATH: {os.environ.get('PATH')}")
17
  # Try finding Chrome binary
18
+ chrome_binary = None
19
+ for binary in ["google-chrome", "google-chrome-stable", "chromium-browser"]:
20
+ try:
21
+ chrome_path = subprocess.check_output(["which", binary]).decode().strip()
22
+ print(f"Found {binary} at: {chrome_path}")
23
+ chrome_binary = binary
24
+ break
25
+ except subprocess.CalledProcessError:
26
+ continue
27
+ if not chrome_binary:
28
+ print("Error: No Chrome binary (google-chrome, google-chrome-stable, chromium-browser) found")
29
+ return
30
+
31
+ # Get Chrome version
32
+ chrome_version = subprocess.check_output([chrome_binary, "--version"]).decode().strip()
33
  print(f"Chrome version: {chrome_version}")
34
+
35
+ # Try finding ChromeDriver
36
+ try:
37
+ chromedriver_path = subprocess.check_output(["which", "chromedriver"]).decode().strip()
38
+ print(f"Found chromedriver at: {chromedriver_path}")
39
+ chromedriver_version = subprocess.check_output(["chromedriver", "--version"]).decode().strip()
40
+ print(f"ChromeDriver version: {chromedriver_version}")
41
+ except subprocess.CalledProcessError as e:
42
+ print(f"Error finding chromedriver: {str(e)}")
43
+
44
  except Exception as e:
45
  print(f"Error checking versions: {str(e)}")
46
 
 
116
  fn=gradio_interface,
117
  inputs=gr.Textbox(label="Enter your prompt", placeholder="e.g., A serene mountain landscape at sunset"),
118
  outputs=[gr.Textbox(label="Result"), gr.Image(label="Generated Image")],
119
+ title="Image Generator with selenium",
120
  description="Enter a prompt to generate an image using gptimage.ai."
121
  )
122