Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -499,27 +499,27 @@ class IntelligentAgent:
|
|
499 |
'image' in file_type or
|
500 |
file_ext in ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp', '.tiff']
|
501 |
)
|
502 |
-
|
503 |
'audio' in file_type or
|
504 |
file_ext in ['.mp3', '.wav', '.m4a', '.ogg', '.flac', '.aac']
|
505 |
)
|
506 |
-
|
507 |
'python' in file_type or 'code' in file_type or 'text' in file_type or
|
508 |
file_ext in ['.py', '.txt', '.js', '.html', '.css', '.json', '.xml']
|
509 |
)
|
510 |
|
511 |
-
|
512 |
-
|
513 |
image_files.append(file_path)
|
514 |
-
|
515 |
audio_files.append(file_path)
|
516 |
-
|
517 |
code_files.append(file_path)
|
518 |
-
|
519 |
# Default to code/text for unknown types
|
520 |
code_files.append(file_path)
|
521 |
|
522 |
-
|
523 |
if self.debug:
|
524 |
print(f"Error processing attachment {i}: {e}")
|
525 |
continue
|
|
|
499 |
'image' in file_type or
|
500 |
file_ext in ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp', '.tiff']
|
501 |
)
|
502 |
+
is_audio = (
|
503 |
'audio' in file_type or
|
504 |
file_ext in ['.mp3', '.wav', '.m4a', '.ogg', '.flac', '.aac']
|
505 |
)
|
506 |
+
is_code = (
|
507 |
'python' in file_type or 'code' in file_type or 'text' in file_type or
|
508 |
file_ext in ['.py', '.txt', '.js', '.html', '.css', '.json', '.xml']
|
509 |
)
|
510 |
|
511 |
+
# Categorize the file
|
512 |
+
if is_image:
|
513 |
image_files.append(file_path)
|
514 |
+
elif is_audio:
|
515 |
audio_files.append(file_path)
|
516 |
+
elif is_code:
|
517 |
code_files.append(file_path)
|
518 |
+
else:
|
519 |
# Default to code/text for unknown types
|
520 |
code_files.append(file_path)
|
521 |
|
522 |
+
except Exception as e:
|
523 |
if self.debug:
|
524 |
print(f"Error processing attachment {i}: {e}")
|
525 |
continue
|