amirulhazym
commited on
Commit
·
2ace594
1
Parent(s):
c4d9cb7
chore: Add deployment artifacts for Hugging Face Spaces
Browse files
setup.sh
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
# This line tells the server that this is a shell script
|
4 |
+
|
5 |
+
# Launch the FastAPI backend API in the background.
|
6 |
+
# The '&' symbol at the end is crucial. It tells the server to run this command
|
7 |
+
# and immediately move on to the next one without waiting for it to finish.
|
8 |
+
echo "Starting backend server..."
|
9 |
+
uvicorn v2_multilingual_api.backend.main:app --host 0.0.0.0 --port 8000 &
|
10 |
+
|
11 |
+
# Give the backend a moment to initialize the AI models.
|
12 |
+
# Loading models can take time. This 'sleep' command pauses for 20 seconds
|
13 |
+
# to ensure the backend is ready before the frontend starts trying to talk to it.
|
14 |
+
echo "Waiting for backend to initialize..."
|
15 |
+
sleep 20
|
16 |
+
|
17 |
+
# Launch the Streamlit frontend.
|
18 |
+
# This is the final command, so it runs in the foreground.
|
19 |
+
# --server.port 7860 is the required port for Streamlit apps on Hugging Face.
|
20 |
+
# --server.address 0.0.0.0 makes it accessible.
|
21 |
+
echo "Starting frontend server..."
|
22 |
+
streamlit run v2_multilingual_api.frontend/app.py --server.port 7860 --server.address 0.0.0.0
|