mirror of
https://github.com/Paillat-dev/presentator.git
synced 2026-01-02 01:06:20 +00:00
hmmm
This commit is contained in:
16
imagesGeneration.py
Normal file
16
imagesGeneration.py
Normal 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
|
||||
Reference in New Issue
Block a user