Spaces:
Sleeping
Sleeping
Upload test_docker_csv.py
Browse files- test_docker_csv.py +38 -0
test_docker_csv.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Test script to verify CSV file can be loaded in Docker environment
|
| 4 |
+
"""
|
| 5 |
+
import os
|
| 6 |
+
import sys
|
| 7 |
+
import pandas as pd
|
| 8 |
+
|
| 9 |
+
def test_csv_in_docker():
|
| 10 |
+
"""Test CSV loading in Docker environment"""
|
| 11 |
+
try:
|
| 12 |
+
# Get the utils directory path
|
| 13 |
+
utils_dir = "/app/utils"
|
| 14 |
+
csv_path = os.path.join(utils_dir, "symbipredict_2022.csv")
|
| 15 |
+
|
| 16 |
+
print(f"Testing CSV loading in Docker...")
|
| 17 |
+
print(f"Utils directory: {utils_dir}")
|
| 18 |
+
print(f"CSV path: {csv_path}")
|
| 19 |
+
print(f"CSV file exists: {os.path.exists(csv_path)}")
|
| 20 |
+
|
| 21 |
+
if os.path.exists(csv_path):
|
| 22 |
+
# Try to read the CSV
|
| 23 |
+
df = pd.read_csv(csv_path)
|
| 24 |
+
print(f"✅ CSV file loaded successfully in Docker!")
|
| 25 |
+
print(f" Shape: {df.shape}")
|
| 26 |
+
print(f" Columns: {list(df.columns)[:5]}...")
|
| 27 |
+
return True
|
| 28 |
+
else:
|
| 29 |
+
print(f"❌ CSV file not found at: {csv_path}")
|
| 30 |
+
return False
|
| 31 |
+
|
| 32 |
+
except Exception as e:
|
| 33 |
+
print(f"❌ Error loading CSV in Docker: {e}")
|
| 34 |
+
return False
|
| 35 |
+
|
| 36 |
+
if __name__ == "__main__":
|
| 37 |
+
success = test_csv_in_docker()
|
| 38 |
+
sys.exit(0 if success else 1)
|