Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,7 +25,7 @@ def generate_image(prompt):
|
|
| 25 |
# Wait for the textarea input field
|
| 26 |
input_field = WebDriverWait(driver, 10).until(
|
| 27 |
EC.presence_of_element_located(
|
| 28 |
-
(By.
|
| 29 |
)
|
| 30 |
)
|
| 31 |
# Enter the prompt
|
|
@@ -34,18 +34,18 @@ def generate_image(prompt):
|
|
| 34 |
# Wait for the "Generate Image" button and click it
|
| 35 |
generate_button = WebDriverWait(driver, 10).until(
|
| 36 |
EC.element_to_be_clickable(
|
| 37 |
-
(By.
|
| 38 |
)
|
| 39 |
)
|
| 40 |
generate_button.click()
|
| 41 |
|
| 42 |
# Wait for the generated image
|
| 43 |
-
generated_image = WebDriverWait(driver,
|
| 44 |
EC.presence_of_element_located(
|
| 45 |
-
(By.
|
| 46 |
)
|
| 47 |
)
|
| 48 |
-
|
| 49 |
# Extract the image URL
|
| 50 |
image_url = generated_image.get_attribute("src")
|
| 51 |
return image_url
|
|
|
|
| 25 |
# Wait for the textarea input field
|
| 26 |
input_field = WebDriverWait(driver, 10).until(
|
| 27 |
EC.presence_of_element_located(
|
| 28 |
+
(By.CLASS_NAME, "wp-content-visualizer-chat-input")
|
| 29 |
)
|
| 30 |
)
|
| 31 |
# Enter the prompt
|
|
|
|
| 34 |
# Wait for the "Generate Image" button and click it
|
| 35 |
generate_button = WebDriverWait(driver, 10).until(
|
| 36 |
EC.element_to_be_clickable(
|
| 37 |
+
(By.CLASS_NAME, "wp-content-visualizer-chat-send")
|
| 38 |
)
|
| 39 |
)
|
| 40 |
generate_button.click()
|
| 41 |
|
| 42 |
# Wait for the generated image
|
| 43 |
+
generated_image = WebDriverWait(driver, 520).until(
|
| 44 |
EC.presence_of_element_located(
|
| 45 |
+
(By.CLASS_NAME, "wp-content-visualizer-generated-image")
|
| 46 |
)
|
| 47 |
)
|
| 48 |
+
|
| 49 |
# Extract the image URL
|
| 50 |
image_url = generated_image.get_attribute("src")
|
| 51 |
return image_url
|