Update app.py
Browse files
app.py
CHANGED
@@ -118,3 +118,20 @@ def embeddings_ep(content: Text = None):
|
|
118 |
headers=headers
|
119 |
)
|
120 |
return JSONResponse(content=result.json())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
headers=headers
|
119 |
)
|
120 |
return JSONResponse(content=result.json())
|
121 |
+
|
122 |
+
|
123 |
+
@app.post("/create_image")
|
124 |
+
def create_image_ep(content: Text = None):
|
125 |
+
url = 'https://api.openai.com/v1/images/generations'
|
126 |
+
obj = json.loads(content.content)
|
127 |
+
data = {
|
128 |
+
"prompt": obj["prompt"],
|
129 |
+
"n": obj["n"],
|
130 |
+
"size": obj["size"]
|
131 |
+
}
|
132 |
+
print("data = \n", data)
|
133 |
+
result = requests.post(url=url,
|
134 |
+
data=json.dumps(data),
|
135 |
+
headers=headers
|
136 |
+
)
|
137 |
+
return JSONResponse(content=result.json())
|