Spaces:
Sleeping
Sleeping
Commit
·
a3dba5f
1
Parent(s):
4dd1198
Got up to docker build ready again, was importing things in block-builder like torch and utilities that weren't needed
Browse files- .gitignore +4 -1
- Dockerfile +2 -1
- block_builder.py +0 -5
- scripts.js +5 -2
.gitignore
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
# Python Cache
|
| 2 |
-
__pycache__/
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Python Cache
|
| 2 |
+
__pycache__/
|
| 3 |
+
|
| 4 |
+
# Environment variables
|
| 5 |
+
.env
|
Dockerfile
CHANGED
|
@@ -21,10 +21,11 @@ COPY --chown=user . $HOME/app
|
|
| 21 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 22 |
|
| 23 |
# Expose port 5000 for the Flask app
|
| 24 |
-
EXPOSE
|
| 25 |
|
| 26 |
# Define environment variable to ensure Flask runs the correct application
|
| 27 |
ENV FLASK_APP=app.py
|
|
|
|
| 28 |
|
| 29 |
# Command to run the Flask app
|
| 30 |
CMD ["flask", "run", "--host=0.0.0.0", "--port=7860"]
|
|
|
|
| 21 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 22 |
|
| 23 |
# Expose port 5000 for the Flask app
|
| 24 |
+
EXPOSE 7860
|
| 25 |
|
| 26 |
# Define environment variable to ensure Flask runs the correct application
|
| 27 |
ENV FLASK_APP=app.py
|
| 28 |
+
ENV FLASK_ENV=production
|
| 29 |
|
| 30 |
# Command to run the Flask app
|
| 31 |
CMD ["flask", "run", "--host=0.0.0.0", "--port=7860"]
|
block_builder.py
CHANGED
|
@@ -1,8 +1,3 @@
|
|
| 1 |
-
import re, fileinput, sys
|
| 2 |
-
import utilities as u
|
| 3 |
-
import os
|
| 4 |
-
import ast
|
| 5 |
-
|
| 6 |
# block_id is a global variable that is used to keep track of the current block id
|
| 7 |
block_id = 0
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# block_id is a global variable that is used to keep track of the current block id
|
| 2 |
block_id = 0
|
| 3 |
|
scripts.js
CHANGED
|
@@ -149,8 +149,11 @@ document.addEventListener("DOMContentLoaded", function() {
|
|
| 149 |
</html>
|
| 150 |
`);
|
| 151 |
|
| 152 |
-
|
| 153 |
-
|
|
|
|
|
|
|
|
|
|
| 154 |
} else {
|
| 155 |
console.error('Element with ID "pages" not found.');
|
| 156 |
}
|
|
|
|
| 149 |
</html>
|
| 150 |
`);
|
| 151 |
|
| 152 |
+
// Wait for the content to be fully loaded before printing
|
| 153 |
+
printWindow.onload = function() {
|
| 154 |
+
printWindow.print();
|
| 155 |
+
printWindow.close(); // Close the print window after printing
|
| 156 |
+
};
|
| 157 |
} else {
|
| 158 |
console.error('Element with ID "pages" not found.');
|
| 159 |
}
|