Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
# https://platform.openai.com/docs/assistants/tools
|
14 |
|
15 |
import gradio as gr
|
16 |
-
import
|
17 |
|
18 |
from openai import OpenAI
|
19 |
from utils import show_json
|
@@ -117,14 +117,12 @@ def get_messages(client, thread):
|
|
117 |
|
118 |
#XXXXX
|
119 |
def extract_file_id(data):
|
120 |
-
|
121 |
-
|
122 |
-
for step in data['data']:
|
123 |
-
if hasattr(step['step_details'], 'tool_calls'):
|
124 |
for tool_call in step['step_details'].tool_calls:
|
125 |
-
if hasattr(tool_call,
|
126 |
for output in tool_call.code_interpreter.outputs:
|
127 |
-
if hasattr(output,
|
128 |
file_id = output.image.file_id
|
129 |
print(f"#############################################3Found file_id: {file_id}")
|
130 |
|
|
|
13 |
# https://platform.openai.com/docs/assistants/tools
|
14 |
|
15 |
import gradio as gr
|
16 |
+
import openai, os, time
|
17 |
|
18 |
from openai import OpenAI
|
19 |
from utils import show_json
|
|
|
117 |
|
118 |
#XXXXX
|
119 |
def extract_file_id(data):
|
120 |
+
for step in data["data"]:
|
121 |
+
if hasattr(step["step_details"], "tool_calls"):
|
|
|
|
|
122 |
for tool_call in step['step_details'].tool_calls:
|
123 |
+
if hasattr(tool_call, "code_interpreter") and hasattr(tool_call.code_interpreter, "outputs"):
|
124 |
for output in tool_call.code_interpreter.outputs:
|
125 |
+
if hasattr(output, "image") and hasattr(output.image, "file_id"):
|
126 |
file_id = output.image.file_id
|
127 |
print(f"#############################################3Found file_id: {file_id}")
|
128 |
|