-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Add support for gpt-4-vision-preview.
2. Add dalle3 to generate images in parallel.
- Loading branch information
Showing
4 changed files
with
106 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# # 假设你的列表如下: | ||
# lst = [{"name": "张三", "age": 20}, {"name": "李四", "age": {"url": "wwww"}}, {"name": "王五", "age": 40}] | ||
|
||
# # 使用列表解析和items()方法取出所有值 | ||
# values = [value for dic in lst for value in dic.values()] | ||
|
||
# # 打印结果 | ||
# print(values) | ||
|
||
def extract_values(obj): | ||
if isinstance(obj, dict): | ||
for value in obj.values(): | ||
yield from extract_values(value) | ||
elif isinstance(obj, list): | ||
for item in obj: | ||
yield from extract_values(item) | ||
else: | ||
yield obj | ||
|
||
lst = [{"name": "张三", "age": 20}, {"name": "李四", "age": {"url": "wwww"}}, {"name": "王五", "age": 40}] | ||
values = list(extract_values(lst)) | ||
print(values) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters