Spaces:
Running
Running
Update vis_python_exe.py
Browse files- vis_python_exe.py +2 -17
vis_python_exe.py
CHANGED
|
@@ -140,20 +140,10 @@ class ImageRuntime(GenericRuntime):
|
|
| 140 |
]
|
| 141 |
|
| 142 |
def __init__(self, messages):
|
| 143 |
-
|
| 144 |
-
# super().__init__()
|
| 145 |
-
# pdb.set_trace()
|
| 146 |
-
|
| 147 |
-
self._global_vars = copy.copy(self.GLOBAL_DICT)
|
| 148 |
-
self._local_vars = copy.copy(self.LOCAL_DICT) if self.LOCAL_DICT else None
|
| 149 |
-
self._captured_figures = []
|
| 150 |
-
|
| 151 |
-
# for c in self.HEADERS:
|
| 152 |
-
# self.exec_code(c)
|
| 153 |
|
| 154 |
image_var_dict = {}
|
| 155 |
image_var_idx = 0
|
| 156 |
-
print("############################### I am initing image runtime ################################")
|
| 157 |
for message_item in messages:
|
| 158 |
content = message_item['content'] # {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{base64_image}"}}
|
| 159 |
for item in content:
|
|
@@ -165,7 +155,7 @@ class ImageRuntime(GenericRuntime):
|
|
| 165 |
image_var_idx += 1
|
| 166 |
|
| 167 |
self.inject(image_var_dict)
|
| 168 |
-
print("#####################
|
| 169 |
|
| 170 |
|
| 171 |
class DateRuntime(GenericRuntime):
|
|
@@ -220,12 +210,7 @@ class PythonExecutor:
|
|
| 220 |
# print("dome")
|
| 221 |
try:
|
| 222 |
# 在每个进程中创建新的运行时实例
|
| 223 |
-
print(f"################################################## I am excuting ! #############################################################")
|
| 224 |
-
print(str(messages)[0:500])
|
| 225 |
-
print(str(messages)[-500:])
|
| 226 |
-
print(runtime_class)
|
| 227 |
runtime = runtime_class(messages)
|
| 228 |
-
print(f"################################################## I am excuting ! #############################################################")
|
| 229 |
|
| 230 |
if get_answer_from_stdout:
|
| 231 |
program_io = io.StringIO()
|
|
|
|
| 140 |
]
|
| 141 |
|
| 142 |
def __init__(self, messages):
|
| 143 |
+
super().__init__()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
|
| 145 |
image_var_dict = {}
|
| 146 |
image_var_idx = 0
|
|
|
|
| 147 |
for message_item in messages:
|
| 148 |
content = message_item['content'] # {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{base64_image}"}}
|
| 149 |
for item in content:
|
|
|
|
| 155 |
image_var_idx += 1
|
| 156 |
|
| 157 |
self.inject(image_var_dict)
|
| 158 |
+
print("##################### Initialized ImageRuntime. ##########################")
|
| 159 |
|
| 160 |
|
| 161 |
class DateRuntime(GenericRuntime):
|
|
|
|
| 210 |
# print("dome")
|
| 211 |
try:
|
| 212 |
# 在每个进程中创建新的运行时实例
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
runtime = runtime_class(messages)
|
|
|
|
| 214 |
|
| 215 |
if get_answer_from_stdout:
|
| 216 |
program_io = io.StringIO()
|