abdullah-113 commited on
Commit
e8e640f
·
verified ·
1 Parent(s): b707cd3

Update run.sh

Browse files
Files changed (1) hide show
  1. run.sh +20 -9
run.sh CHANGED
@@ -1,12 +1,23 @@
1
- #!/bin/bash
 
2
 
3
- # Start the FastAPI backend in the background
4
- echo "Starting FastAPI Backend..."
5
- uvicorn api.main:app --host 127.0.0.1 --port 8000 &
 
6
 
7
- # Wait a few seconds to let the ML model load into memory
8
- sleep 10
9
 
10
- # Start the Streamlit frontend on Hugging Face's required port
11
- echo "Starting Streamlit Frontend..."
12
- streamlit run frontend/app.py --server.port 7860 --server.address 0.0.0.0
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official lightweight Python image
2
+ FROM python:3.10-slim
3
 
4
+ # Hugging Face Spaces require the app to run as user '1000'
5
+ RUN useradd -m -u 1000 user
6
+ USER user
7
+ ENV PATH="/home/user/.local/bin:$PATH"
8
 
9
+ # Set the working directory inside the container
10
+ WORKDIR /app
11
 
12
+ # Copy all your local files into the container
13
+ COPY --chown=user . /app
14
+
15
+ # Install all your Python packages
16
+ RUN pip install --no-cache-dir -r requirements.txt
17
+
18
+ # Expose port 7860
19
+ EXPOSE 7860
20
+
21
+ # BYPASS run.sh and run everything directly in the Docker CMD
22
+ # This prevents the Windows/Linux invisible character crash
23
+ CMD ["bash", "-c", "uvicorn api.main:app --host 127.0.0.1 --port 8000 & sleep 10 && streamlit run frontend/app.py --server.port 7860 --server.address 0.0.0.0"]