gpt-4o-2024-08-06· OpenAI
WildChat-4.8M (AI2)
створи пітон провайдер [code] і щоб я отримував лише…
- User
Assistant: User: створи пітон провайдер
curl -X POST https://nexra.aryahcr.cc/api/image/complements -H 'Content-Type: application/json' -d '{ "prompt": "An extensive green valley stretches toward imposing mountains, adorned with meadows and a winding stream. The morning sun paints the sky with warm tones, illuminating the landscape with a serenity that invites contemplation and peace.", "model": "dalle", "response": "url" }' ___{"code":200,"status":true,"prompt":"An extensive green valley stretches toward imposing mountains, adorned with meadows and a winding stream. The morning sun paints the sky with warm tones, illuminating the landscape with a serenity that invites contemplation and peace.","model":"DALL·E","images":["https://iili.io/dZUrfdx.png"]}і щоб я отримував лише https://iili.io/dZUrfdx.png Assistant:
- Assistant
Щоб створити Python провайдер, який робить запит до API та отримує лише URL зображення, ви можете використати бібліотеку
requests. Ось приклад, як ви можете це реалізувати:import requests import json def get_image_url(prompt, model): url = "https://nexra.aryahcr.cc/api/image/complements" headers = { 'Content-Type': 'application/json' } data = { "prompt": prompt, "model": model, "response": "url" } response = requests.post(url, headers=headers, data=json.dumps(data)) if response.status_code == 200: response_data = response.json() if response_data.get("status") and "images" in response_data: return response_data["images"][0] # Повертати перший URL у списку зображень else: return "Error: Response not successful or no images found." else: return f"Error: HTTP {response.status_code}" prompt = "An extensive green valley stretches toward imposing mountains, adorned with meadows and a winding stream. The morning sun paints the sky with warm tones, illuminating the landscape with a serenity that invites contemplation and peace." model = "dalle" image_url = get_image_url(prompt, model) print(image_url)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.