Spaces:
Build error
Build error
Create setup.py
Browse files
setup.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
import os
|
| 3 |
+
import sys
|
| 4 |
+
import subprocess
|
| 5 |
+
import requests
|
| 6 |
+
|
| 7 |
+
def download_model_weights():
|
| 8 |
+
"""Download pre-trained model weights"""
|
| 9 |
+
models_dir = "models"
|
| 10 |
+
os.makedirs(models_dir, exist_ok=True)
|
| 11 |
+
|
| 12 |
+
# URLs to model weights (placeholder - use your actual trained models)
|
| 13 |
+
model_urls = {
|
| 14 |
+
"chest_xray.pth": "https://example.com/models/chest_xray.pth",
|
| 15 |
+
"ultrasound.pth": "https://example.com/models/ultrasound.pth"
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
print("Downloading model weights...")
|
| 19 |
+
for filename, url in model_urls.items():
|
| 20 |
+
filepath = os.path.join(models_dir, filename)
|
| 21 |
+
if not os.path.exists(filepath):
|
| 22 |
+
try:
|
| 23 |
+
response = requests.get(url, stream=True)
|
| 24 |
+
with open(filepath, 'wb') as f:
|
| 25 |
+
for chunk in response.iter_content(chunk_size=8192):
|
| 26 |
+
f.write(chunk)
|
| 27 |
+
print(f"Downloaded {filename}")
|
| 28 |
+
except Exception as e:
|
| 29 |
+
print(f"Failed to download {filename}: {e}")
|
| 30 |
+
|
| 31 |
+
if __name__ == "__main__":
|
| 32 |
+
print("Setting up Rural Diagnostic Assistant...")
|
| 33 |
+
|
| 34 |
+
# Install requirements
|
| 35 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
|
| 36 |
+
|
| 37 |
+
# Download models
|
| 38 |
+
download_model_weights()
|
| 39 |
+
|
| 40 |
+
print("Setup complete! Run: streamlit run app.py")
|