Spaces:
Build error
Build error
Commit
·
b8a1992
1
Parent(s):
30dd301
configured the run_dev shell script
Browse files- README.md +2 -5
- neural_network/plot.py +3 -1
- package-lock.json +1 -1
- requirements.txt +6 -5
- run.sh +0 -3
- run_dev.sh +30 -0
README.md
CHANGED
|
@@ -14,9 +14,6 @@
|
|
| 14 |
3. `npx tailwindcss -i ./static/src/input.css -o ./static/dist/css/output.css --watch` <br>
|
| 15 |
<br>
|
| 16 |
(in another terminal window) <br>
|
| 17 |
-
4. `
|
| 18 |
-
|
| 19 |
-
### Prod
|
| 20 |
-
1. `chmod +x run.sh` <br>
|
| 21 |
-
2. `./run.sh` <br>
|
| 22 |
|
|
|
|
| 14 |
3. `npx tailwindcss -i ./static/src/input.css -o ./static/dist/css/output.css --watch` <br>
|
| 15 |
<br>
|
| 16 |
(in another terminal window) <br>
|
| 17 |
+
4. `chmod +x run.sh` <br>
|
| 18 |
+
5. `./run.sh` <br>
|
|
|
|
|
|
|
|
|
|
| 19 |
|
neural_network/plot.py
CHANGED
|
@@ -10,6 +10,8 @@ we would like to show results on our little
|
|
| 10 |
flask application
|
| 11 |
"""
|
| 12 |
|
|
|
|
|
|
|
| 13 |
|
| 14 |
def loss_history_plt(loss_history: list) -> FuncAnimation:
|
| 15 |
fig, ax = plt.subplots()
|
|
@@ -32,4 +34,4 @@ def save_plt(plot, filename: str, animated: bool, fps=10):
|
|
| 32 |
plot.savefig(filename)
|
| 33 |
return
|
| 34 |
writer = FFMpegWriter(fps=fps)
|
| 35 |
-
plot.save(filename, writer=writer)
|
|
|
|
| 10 |
flask application
|
| 11 |
"""
|
| 12 |
|
| 13 |
+
PLT_PATH: str = "static/assets/"
|
| 14 |
+
|
| 15 |
|
| 16 |
def loss_history_plt(loss_history: list) -> FuncAnimation:
|
| 17 |
fig, ax = plt.subplots()
|
|
|
|
| 34 |
plot.savefig(filename)
|
| 35 |
return
|
| 36 |
writer = FFMpegWriter(fps=fps)
|
| 37 |
+
plot.save(PLT_PATH + filename, writer=writer)
|
package-lock.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"name": "
|
| 3 |
"lockfileVersion": 3,
|
| 4 |
"requires": true,
|
| 5 |
"packages": {
|
|
|
|
| 1 |
{
|
| 2 |
+
"name": "Data-Mining-Study",
|
| 3 |
"lockfileVersion": 3,
|
| 4 |
"requires": true,
|
| 5 |
"packages": {
|
requirements.txt
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
Flask==2.2.3
|
| 2 |
-
matplotlib==3.7.1
|
| 3 |
-
numpy==1.24.2
|
| 4 |
-
scikit_learn==1.2.2
|
| 5 |
-
seaborn==0.12.2
|
| 6 |
-
tqdm==4.65.0
|
| 7 |
gunicorn==20.1.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
Flask==2.2.3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
gunicorn==20.1.0
|
| 3 |
+
|
| 4 |
+
numpy~=1.24.2
|
| 5 |
+
matplotlib~=3.7.1
|
| 6 |
+
scikit-learn~=1.2.2
|
| 7 |
+
seaborn~=0.12.2
|
| 8 |
+
tqdm~=4.65.0
|
run.sh
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
|
| 3 |
-
gunicorn --bind :3000 --workers 1 --threads 8 --timeout 0 app:app
|
|
|
|
|
|
|
|
|
|
|
|
run_dev.sh
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Function to handle SIGINT signal
|
| 4 |
+
function cleanup {
|
| 5 |
+
echo "Cleaning up and exiting..."
|
| 6 |
+
kill $TAILWIND_PID
|
| 7 |
+
kill $FLASK_PID
|
| 8 |
+
exit 0
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
# Register cleanup function to be called when SIGINT is received
|
| 12 |
+
trap cleanup SIGINT
|
| 13 |
+
|
| 14 |
+
# Start tailwindcss watch process in the background
|
| 15 |
+
npx tailwindcss -i ./static/src/input.css -o ./static/dist/css/output.css --watch &
|
| 16 |
+
TAILWIND_PID=$!
|
| 17 |
+
|
| 18 |
+
# Wait for the CSS files to be generated before starting the Flask server
|
| 19 |
+
sleep 2
|
| 20 |
+
|
| 21 |
+
# Start the Flask server in the background
|
| 22 |
+
python app.py &
|
| 23 |
+
FLASK_PID=$!
|
| 24 |
+
|
| 25 |
+
# Wait for both processes to finish
|
| 26 |
+
wait $TAILWIND_PID $FLASK_PID
|
| 27 |
+
|
| 28 |
+
# When the wait command completes, kill both processes
|
| 29 |
+
kill $TAILWIND_PID
|
| 30 |
+
kill $FLASK_PID
|