|
发表于 2025-3-21 17:58:20
|
显示全部楼层
捕获网址:https://pollinations.ai/
上面提供的python调用:
- # Python code example for downloading an image
- import requests
- def download_image(image_url):
- # Fetching the image from the URL
- response = requests.get(image_url)
- # Writing the content to a file named 'image.jpg'
- with open('image.jpg', 'wb') as file:
- file.write(response.content)
- # Logging completion message
- print('Download Completed')
- # Image details
- prompt = 'A beautiful landscape'
- width = 1024
- height = 1024
- seed = 42 # Each seed generates a new image variation
- model = 'flux' # Using 'flux' as default if model is not provided
- image_url = f"https://pollinations.ai/p/{prompt}?width={width}&height={height}&seed={seed}&model={model}"
- download_image(image_url)
- # Using the pollinations pypi package
- ## pip install pollinations
- import pollinations as ai
- model_obj = ai.Model()
- image = model_obj.generate(
- prompt=f'A beautiful landscape {ai.realistic}',
- model=ai.flux,
- width=1024,
- height=1024,
- seed=42
- )
- image.save('image-output.jpg')
- print(image.url)
复制代码 |
评分
-
查看全部评分
|