LexGuardian / setup.py
sunbal7's picture
Create setup.py
d9d0adc verified
raw
history blame
1.36 kB
#!/usr/bin/env python3
import os
import sys
import subprocess
import requests
def download_model_weights():
"""Download pre-trained model weights"""
models_dir = "models"
os.makedirs(models_dir, exist_ok=True)
# URLs to model weights (placeholder - use your actual trained models)
model_urls = {
"chest_xray.pth": "https://example.com/models/chest_xray.pth",
"ultrasound.pth": "https://example.com/models/ultrasound.pth"
}
print("Downloading model weights...")
for filename, url in model_urls.items():
filepath = os.path.join(models_dir, filename)
if not os.path.exists(filepath):
try:
response = requests.get(url, stream=True)
with open(filepath, 'wb') as f:
for chunk in response.iter_content(chunk_size=8192):
f.write(chunk)
print(f"Downloaded {filename}")
except Exception as e:
print(f"Failed to download {filename}: {e}")
if __name__ == "__main__":
print("Setting up Rural Diagnostic Assistant...")
# Install requirements
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
# Download models
download_model_weights()
print("Setup complete! Run: streamlit run app.py")