rphrp1985 commited on
Commit
ec5749b
1 Parent(s): 33b17d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -144,7 +144,20 @@ async def get_answer(q: QueryM ):
144
 
145
 
146
 
147
-
 
 
 
 
 
 
 
 
 
 
 
 
 
148
 
149
 
150
 
 
144
 
145
 
146
 
147
+ @app.post("/image_new")
148
+ async def get_answer(q: Query ):
149
+ text = q.text
150
+ try:
151
+ global client
152
+ imagei = client.post(json={"inputs": text}, model='openskyml/dalle-3-xl')
153
+ byte_array = io.BytesIO()
154
+ imagei.save(byte_array, format='JPEG')
155
+ response = Response(content=byte_array.getvalue(), media_type="image/png")
156
+ return response
157
+
158
+ except:
159
+ return JSONResponse({"status":False})
160
+
161
 
162
 
163