This commit is contained in:
Paillat
2023-02-06 01:01:47 +01:00
parent f54e627d9a
commit 5c008230dc
3 changed files with 1 additions and 1 deletions

16
imagesGeneration.py Normal file
View File

@@ -0,0 +1,16 @@
import requests
import os
import openai
async def generate(prompt, path, mode, openai_key):
#r = requests.get(f"http://localhost:8000/generate_image?prompt={prompt}&path={path}")
if mode == "sd":
r = requests.get(f"http://localhost:8000/generate_image?prompt={prompt}&path={path}")
return "image generated"
if mode == "dalle":
openai.api_key = openai_key
img = await openai.Image.acreate(
prompt=prompt,
n=1,
size="1024x1024",
)
return img