Spaces:
Paused
Paused
Update app.py
Browse files
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 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
print(f"Chrome version: {chrome_version}")
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
| 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 |
|