Delete run.py
Browse files
run.py
DELETED
@@ -1,71 +0,0 @@
|
|
1 |
-
"""
|
2 |
-
MediSync: Multi-Modal Medical Analysis System - Runner Script
|
3 |
-
============================================================
|
4 |
-
This script downloads sample data and launches the MediSync application.
|
5 |
-
"""
|
6 |
-
|
7 |
-
import logging
|
8 |
-
import sys
|
9 |
-
from pathlib import Path
|
10 |
-
|
11 |
-
# Set up logging
|
12 |
-
logging.basicConfig(
|
13 |
-
level=logging.INFO,
|
14 |
-
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
15 |
-
handlers=[logging.StreamHandler(), logging.FileHandler("mediSync.log")],
|
16 |
-
)
|
17 |
-
logger = logging.getLogger(__name__)
|
18 |
-
|
19 |
-
|
20 |
-
def main():
|
21 |
-
"""
|
22 |
-
Main function to set up and run the MediSync application.
|
23 |
-
"""
|
24 |
-
logger.info("Starting MediSync setup")
|
25 |
-
|
26 |
-
# Add the current directory to Python path
|
27 |
-
current_dir = Path(__file__).resolve().parent
|
28 |
-
sys.path.append(str(current_dir))
|
29 |
-
|
30 |
-
# Download sample data if needed
|
31 |
-
try:
|
32 |
-
logger.info("Checking for sample data")
|
33 |
-
from mediSync.utils.download_samples import (
|
34 |
-
create_sample_info_file,
|
35 |
-
download_sample_images,
|
36 |
-
)
|
37 |
-
|
38 |
-
# Check if sample directory exists and contains images
|
39 |
-
sample_dir = current_dir / "mediSync" / "data" / "sample"
|
40 |
-
sample_dir.mkdir(parents=True, exist_ok=True)
|
41 |
-
|
42 |
-
image_files = list(sample_dir.glob("*.jpg")) + list(sample_dir.glob("*.png"))
|
43 |
-
|
44 |
-
if not image_files:
|
45 |
-
logger.info("No sample images found. Downloading...")
|
46 |
-
download_sample_images()
|
47 |
-
create_sample_info_file()
|
48 |
-
else:
|
49 |
-
logger.info(f"Found {len(image_files)} existing sample images")
|
50 |
-
|
51 |
-
except Exception as e:
|
52 |
-
logger.error(f"Error setting up sample data: {e}")
|
53 |
-
print(f"Warning: Could not set up sample data: {e}")
|
54 |
-
|
55 |
-
# Launch the application
|
56 |
-
try:
|
57 |
-
logger.info("Launching MediSync application")
|
58 |
-
from mediSync.app import create_interface
|
59 |
-
|
60 |
-
create_interface()
|
61 |
-
|
62 |
-
except Exception as e:
|
63 |
-
logger.error(f"Error launching application: {e}")
|
64 |
-
print(f"Error: Failed to launch MediSync application: {e}")
|
65 |
-
return 1
|
66 |
-
|
67 |
-
return 0
|
68 |
-
|
69 |
-
|
70 |
-
if __name__ == "__main__":
|
71 |
-
sys.exit(main())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|