lanny xu commited on
Commit
df14376
·
1 Parent(s): de81fb9

delete vectara

Browse files
Files changed (1) hide show
  1. kaggle_simple_multimodal.py +14 -2
kaggle_simple_multimodal.py CHANGED
@@ -130,12 +130,16 @@ def scan_and_copy_files():
130
  # 跳过无效文件名
131
  if not file or file.startswith('.') or len(file) < 5:
132
  continue
 
 
 
133
 
134
  src = os.path.join(root, file)
135
  dst = os.path.join(working_dir, file)
136
 
137
  try:
138
- if file.endswith('.pdf'):
 
139
  shutil.copy(src, dst)
140
  copied_pdfs.append(file)
141
  print(f" ✅ 复制 PDF: {file}")
@@ -143,6 +147,8 @@ def scan_and_copy_files():
143
  shutil.copy(src, dst)
144
  copied_images.append(file)
145
  print(f" ✅ 复制图片: {file}")
 
 
146
  except Exception as e:
147
  print(f" ⚠️ 复制文件失败 {file}: {e}")
148
 
@@ -150,6 +156,10 @@ def scan_and_copy_files():
150
  print(f"\n📁 复制完成: {len(copied_pdfs)} 个 PDF, {len(copied_images)} 张图片")
151
  else:
152
  print("⚠️ 未找到 PDF 或图片文件")
 
 
 
 
153
 
154
  def main():
155
  """主函数"""
@@ -168,9 +178,11 @@ def main():
168
  # 过滤有效的PDF文件(排除空文件名和隐藏文件)
169
  try:
170
  all_files = os.listdir(working_dir)
 
 
171
  pdf_files = [
172
  f for f in all_files
173
- if f.endswith('.pdf')
174
  and len(f) > 4 # 确保不只是 '.pdf'
175
  and not f.startswith('.') # 排除隐藏文件
176
  and os.path.isfile(os.path.join(working_dir, f)) # 确保是文件
 
130
  # 跳过无效文件名
131
  if not file or file.startswith('.') or len(file) < 5:
132
  continue
133
+
134
+ # 调试:显示所有文件
135
+ print(f" 🔍 扫描到: {file}")
136
 
137
  src = os.path.join(root, file)
138
  dst = os.path.join(working_dir, file)
139
 
140
  try:
141
+ # 修复:使用小写比较,支持 .pdf, .PDF, .Pdf 等
142
+ if file.lower().endswith('.pdf'):
143
  shutil.copy(src, dst)
144
  copied_pdfs.append(file)
145
  print(f" ✅ 复制 PDF: {file}")
 
147
  shutil.copy(src, dst)
148
  copied_images.append(file)
149
  print(f" ✅ 复制图片: {file}")
150
+ else:
151
+ print(f" ⚪ 跳过非目标文件: {file}")
152
  except Exception as e:
153
  print(f" ⚠️ 复制文件失败 {file}: {e}")
154
 
 
156
  print(f"\n📁 复制完成: {len(copied_pdfs)} 个 PDF, {len(copied_images)} 张图片")
157
  else:
158
  print("⚠️ 未找到 PDF 或图片文件")
159
+ print("\n🔍 请检查:")
160
+ print(" 1. 文件是否已上传到 Kaggle")
161
+ print(" 2. 文件是否在 /kaggle/input/ 目录下")
162
+ print(" 3. 文件扩展名是否正确 (.pdf, .jpg, .png 等)")
163
 
164
  def main():
165
  """主函数"""
 
178
  # 过滤有效的PDF文件(排除空文件名和隐藏文件)
179
  try:
180
  all_files = os.listdir(working_dir)
181
+
182
+ # 修复:使用小写比较,支持 .pdf, .PDF, .Pdf 等
183
  pdf_files = [
184
  f for f in all_files
185
+ if f.lower().endswith('.pdf') # 改为小写比较
186
  and len(f) > 4 # 确保不只是 '.pdf'
187
  and not f.startswith('.') # 排除隐藏文件
188
  and os.path.isfile(os.path.join(working_dir, f)) # 确保是文件