File size: 1,835 Bytes
535be32 02317a2 535be32 02317a2 535be32 02317a2 535be32 02317a2 535be32 02317a2 535be32 02317a2 a255907 02317a2 a255907 02317a2 a255907 02317a2 a255907 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# s.py
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
# Create a new instance of the Chrome driver
driver = webdriver.Chrome()
# Navigate to Google
driver.get("https://www.google.com")
# Find the search box using its name attribute value
search_box = driver.find_element("name", "q")
# Type a search query
search_box.send_keys("Hello, Docker!")
# Submit the search form
search_box.send_keys(Keys.RETURN)
# Wait for a few seconds to observe the result
input("Press Enter to exit...")
# Close the browser window
driver.quit()
# import time
# from g4f.Provider.bing import CreateImagesBing
# class ImageTextGenerator:
# def __init__(self, prompt, max_attempts=5):
# self.prompt = prompt
# self.max_attempts = max_attempts
# self.results = []
# def generate_images_text(self):
# attempts = 0
# while attempts < self.max_attempts:
# try:
# bing_images_provider = CreateImagesBing()
# result_generator = bing_images_provider.create_completion(prompt=self.prompt)
# # Collect results in a list
# self.results.extend(result_generator)
# # Successful execution, break the loop
# break
# except (RuntimeError, Exception) as e:
# print(f"Error: {e}")
# print(f"Error during image creation (Attempt {attempts + 1}/{self.max_attempts})")
# attempts += 1
# # For the first attempt, add a delay
# if attempts == 1:
# time.sleep(1) # Add a delay between attempts if needed
# return self.results
# print("sssssssssssssssssss1111")
# s = ImageTextGenerator("red Cow").generate_images_text()
# print("sssssssssssssssssss", s) |