Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -881,7 +881,7 @@ If a MCP server requires a password input you will use {pwdList[0]}.
|
|
| 881 |
model= "gpt-5-mini", #"gpt-5-mini", "o4-mini",
|
| 882 |
tools=[{ "type": "web_search" },
|
| 883 |
{ "type": "code_interpreter", "container": container_id}, #{'type': 'auto'}},
|
| 884 |
-
{ "type": "image_generation", "quality": "medium", "size": "
|
| 885 |
{"type": "function", "name": "get_distance",
|
| 886 |
"description": "get calculated straight-line (great-circle) distance between two locations or addresses.",
|
| 887 |
"parameters": {
|
|
@@ -1487,7 +1487,9 @@ def make_image(prompt, user, pwd):
|
|
| 1487 |
msg = ex.message
|
| 1488 |
return [gr.Image(visible=False, value=None), msg]
|
| 1489 |
|
| 1490 |
-
pnum =
|
|
|
|
|
|
|
| 1491 |
for event in response:
|
| 1492 |
if event.type == "image_generation.partial_image":
|
| 1493 |
idx = event.partial_image_index
|
|
@@ -1497,25 +1499,9 @@ def make_image(prompt, user, pwd):
|
|
| 1497 |
with open(fpath, "wb") as fp:
|
| 1498 |
fp.write(image_bytes)
|
| 1499 |
pnum += 1
|
| 1500 |
-
yield(gr.Image(value=None, visible=False),
|
| 1501 |
-
|
| 1502 |
-
# if len(response.data) == 0:
|
| 1503 |
-
# msg = "OpenAI returned no image data"
|
| 1504 |
-
# return [gr.Image(visible=False, value=None), msg]
|
| 1505 |
-
# try:
|
| 1506 |
-
# image_data = response.data[0].b64_json
|
| 1507 |
-
# with Image.open(BytesIO(base64.b64decode(image_data))) as image:
|
| 1508 |
-
# fpath = dataDir + user + '.png'
|
| 1509 |
-
# image.save(fpath)
|
| 1510 |
-
# with open(image_count_path(user), 'at') as fp:
|
| 1511 |
-
# if quality == 'hd':
|
| 1512 |
-
# fp.write('hd\n')
|
| 1513 |
-
# else:
|
| 1514 |
-
# fp.write('1\n')
|
| 1515 |
|
| 1516 |
msg = 'Image created!'
|
| 1517 |
-
# except:
|
| 1518 |
-
# return [gr.Image(visible=False, value=None), msg]
|
| 1519 |
else:
|
| 1520 |
msg = 'Incorrect user name or password'
|
| 1521 |
return [gr.Image(visible=False, value=None), msg]
|
|
|
|
| 881 |
model= "gpt-5-mini", #"gpt-5-mini", "o4-mini",
|
| 882 |
tools=[{ "type": "web_search" },
|
| 883 |
{ "type": "code_interpreter", "container": container_id}, #{'type': 'auto'}},
|
| 884 |
+
{ "type": "image_generation", "model": "gpt-image-2", "quality": "medium", "size": "1536x1024"},
|
| 885 |
{"type": "function", "name": "get_distance",
|
| 886 |
"description": "get calculated straight-line (great-circle) distance between two locations or addresses.",
|
| 887 |
"parameters": {
|
|
|
|
| 1487 |
msg = ex.message
|
| 1488 |
return [gr.Image(visible=False, value=None), msg]
|
| 1489 |
|
| 1490 |
+
pnum = -1
|
| 1491 |
+
msgs = ["Working on it ...","Making progress ...",
|
| 1492 |
+
"Getting closer ...", "Almost there ..."]
|
| 1493 |
for event in response:
|
| 1494 |
if event.type == "image_generation.partial_image":
|
| 1495 |
idx = event.partial_image_index
|
|
|
|
| 1499 |
with open(fpath, "wb") as fp:
|
| 1500 |
fp.write(image_bytes)
|
| 1501 |
pnum += 1
|
| 1502 |
+
yield(gr.Image(value=None, visible=False), msgs[pnum])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1503 |
|
| 1504 |
msg = 'Image created!'
|
|
|
|
|
|
|
| 1505 |
else:
|
| 1506 |
msg = 'Incorrect user name or password'
|
| 1507 |
return [gr.Image(visible=False, value=None), msg]
|