中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當前位置: 首頁 > news >正文

比較著名的seo網(wǎng)站點擊器免費版

比較著名的seo網(wǎng)站,點擊器免費版,如何建立和設(shè)計公司的網(wǎng)站,05網(wǎng)站以AnyEdit數(shù)據(jù)集為例,我們展示了批量讀取parquet圖片文件的代碼,相關(guān)數(shù)據(jù)集地址如下: Huggingface-AnyEdit 代碼如下所示,請注意使用時應(yīng)查看文件格式來適應(yīng)性修改代碼 import os import pandas as pd import io import json fr…

以AnyEdit數(shù)據(jù)集為例,我們展示了批量讀取parquet圖片文件的代碼,相關(guān)數(shù)據(jù)集地址如下:
Huggingface-AnyEdit

代碼如下所示,請注意使用時應(yīng)查看文件格式來適應(yīng)性修改代碼

import os
import pandas as pd
import io
import json
from tqdm import tqdm
from PIL import Image# 讀取 parquet 文件
df = pd.read_parquet('./data/train-00000-of-00383.parquet')# 查看第一行數(shù)據(jù)
sample_row = df.iloc[0]  # 獲取第一行數(shù)據(jù)
print(sample_row)#--------------------------------#
# 獲取data文件夾下的所有parquet文件
#--------------------------------#
parquet_dir      = './data'
parquet_files    = [f for f in os.listdir(parquet_dir) if f.endswith('.parquet')]# 創(chuàng)建新的文件夾來保存圖片
base_output_dir  = './extracted_images'
os.makedirs(base_output_dir, exist_ok=True)image_dir        = os.path.join(base_output_dir, 'image_files')
edited_dir       = os.path.join(base_output_dir, 'edited_files')
visual_input_dir = os.path.join(base_output_dir, 'visual_input_files')# 創(chuàng)建子文件夾
os.makedirs(image_dir, exist_ok=True)
os.makedirs(edited_dir, exist_ok=True)
os.makedirs(visual_input_dir, exist_ok=True)# 創(chuàng)建一個字典保存除了圖像數(shù)據(jù)外的所有內(nèi)容
non_image_data = []#-------------------#
# 遍歷所有parquet文件
#-------------------#
for parquet_file in parquet_files:file_path = os.path.join(parquet_dir, parquet_file)print(f"Processing file: {file_path}")# 讀取 parquet 文件df = pd.read_parquet(file_path)# 使用 tqdm 包裝 DataFrame 的迭代器以顯示進度條for index, row in tqdm(df.iterrows(), total=len(df), desc=f"Processing {parquet_file}"):# 提取圖片字節(jié)數(shù)據(jù)image_file_data   = row['image_file']edited_file_data  = row['edited_file']visual_input_data = row['visual_input']# 提取除了圖像列以外的其他數(shù)據(jù)row_data = {'image_id': row['image_id'],'edit_instruction': row['edit_instruction'],'edit_type': row['edit_type'],'input': row['input'],'output': row['output']}# 添加該行的非圖像數(shù)據(jù)到字典列表中non_image_data.append(row_data)# 獲取 image_id 來命名圖像文件image_id = row['image_id']# 確保字節(jié)數(shù)據(jù)存在for image_data, label in [(image_file_data, 'image_file'), (edited_file_data, 'edited_file'), (visual_input_data, 'visual_input')]:if isinstance(image_data, dict) and 'bytes' in image_data:# 將字節(jié)數(shù)據(jù)轉(zhuǎn)換為圖片image = Image.open(io.BytesIO(image_data['bytes']))# 使用 image_id 作為圖像文件名image_name = f"{image_id}.jpg"# 根據(jù)標簽選擇目標子文件夾if label   == 'image_file':target_dir = image_direlif label == 'edited_file':target_dir = edited_direlif label == 'visual_input':target_dir = visual_input_direlse:continue  # 如果標簽沒有匹配的,跳過# 定義目標保存路徑target_path = os.path.join(target_dir, image_name)# 保存圖片image.save(target_path)else:print(f"Skipping invalid data for {label} in row {index}")# 將非圖像數(shù)據(jù)保存為 JSON 文件
json_file_path = './data.json'
with open(json_file_path, 'w') as json_file:json.dump(non_image_data, json_file)print(f"Non-image data saved to '{json_file_path}'")

http://www.risenshineclean.com/news/61513.html

相關(guān)文章:

  • 做網(wǎng)站和網(wǎng)頁區(qū)別省委副書記
  • ps怎么做網(wǎng)站首頁和超鏈接注冊一個公司網(wǎng)站需要多少錢
  • 汕頭網(wǎng)站建設(shè)備案關(guān)鍵詞優(yōu)化seo外包
  • 做外貿(mào)要看哪些網(wǎng)站app運營推廣策劃方案
  • 濮陽做網(wǎng)站建設(shè)的公司最好的推廣平臺排名
  • 上海品牌網(wǎng)站建設(shè)公司廣州市口碑seo推廣
  • 自己做的網(wǎng)站怎么設(shè)置文件下載seo優(yōu)化顧問服務(wù)
  • 如何做網(wǎng)站標頭長沙seo排名公司
  • 惠州+網(wǎng)站建設(shè)公司南昌seo管理
  • 萍鄉(xiāng)做網(wǎng)站的公司競價托管 微競價
  • 南宮做網(wǎng)站seo快速推廣竅門大公開
  • 運營seo是什么意思群排名優(yōu)化軟件
  • 酒業(yè)網(wǎng)站建設(shè)優(yōu)化大師免費版下載
  • 陽江網(wǎng)站seo公司提供seo服務(wù)
  • 義烏網(wǎng)站建設(shè)多少錢百度短鏈接在線生成
  • 如何編輯網(wǎng)站標題欄美國搜索引擎排名
  • 去哪找想做網(wǎng)站的客戶重慶seo小潘大神
  • 鄭州營銷型網(wǎng)站建設(shè)哪家好韶關(guān)網(wǎng)站seo
  • 南寧網(wǎng)站建設(shè)報價免費注冊網(wǎng)址
  • 卡盟網(wǎng)站怎么做圖片素材公司官網(wǎng)制作多少錢
  • 怎么查詢網(wǎng)站所有關(guān)鍵詞怎樣進行網(wǎng)絡(luò)推廣效果更好
  • 長沙做網(wǎng)站建設(shè)公司排名沈陽seo公司
  • 武漢公司做網(wǎng)站可口可樂營銷策劃方案
  • WordPress默認模板做的站軟件培訓班
  • 基金管理公司司網(wǎng)站建設(shè)要求百度推廣區(qū)域代理
  • 做宣傳單用什么網(wǎng)站找圖片優(yōu)化培訓方式
  • 修改wordpress代碼加快打開速度seo怎么做關(guān)鍵詞排名
  • 上海聯(lián)通 網(wǎng)站備案百度競價托管外包
  • 建設(shè)工程信息網(wǎng)官網(wǎng)首頁seo整合營銷
  • 網(wǎng)站建設(shè) 要維護么網(wǎng)絡(luò)推廣合同