Spaces:
Sleeping
Sleeping
File size: 1,890 Bytes
abbb0b9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | """
Hugging Face Space Deployment Helper
====================================
"""
import os
import subprocess
import sys
def deploy_to_huggingface():
"""Deploy SuperKart API to Hugging Face Spaces"""
print("[DEPLOY] SuperKart Sales Forecasting API")
print("=" * 50)
# Check if backend files exist
backend_dir = "backend_files"
if not os.path.exists(backend_dir):
print(f"Error: {backend_dir} directory not found!")
print("Please ensure you're running from the project root directory.")
return False
# List required files
required_files = [
"app.py",
"requirements.txt",
"Dockerfile",
"README.md",
"superkart_sales_forecasting_model.joblib"
]
missing_files = []
for file in required_files:
file_path = os.path.join(backend_dir, file)
if not os.path.exists(file_path):
missing_files.append(file)
if missing_files:
print(f"Error: Missing required files: {missing_files}")
return False
print("β
All required files found")
# Instructions for manual deployment
print(f"""
π MANUAL DEPLOYMENT STEPS:
1. Create Hugging Face Space:
β’ Go to: https://huggingface.co/new-space
β’ Name: superkart-sales-api
β’ SDK: Docker
β’ Hardware: CPU Basic
2. Clone your space:
git clone https://huggingface.co/spaces/yourusername/superkart-sales-api
cd superkart-sales-api
3. Copy files:
Copy all files from {backend_dir}/ to your space directory
4. Deploy:
git add .
git commit -m "Initial deployment"
git push origin main
π Your API will be live at:
https://yourusername-superkart-sales-api.hf.space
""")
return True
if __name__ == "__main__":
deploy_to_huggingface()
|