Update BrainBot.py
Browse files- BrainBot.py +6 -4
BrainBot.py
CHANGED
@@ -17,8 +17,9 @@ def save_uploaded_file(uploaded_file):
|
|
17 |
file_content = uploaded_file.read() # Load the document
|
18 |
|
19 |
# Create a directory if it doesn't exist
|
20 |
-
data_dir = "/data"
|
21 |
-
|
|
|
22 |
|
23 |
# Create a temporary file in the data directory
|
24 |
with tempfile.NamedTemporaryFile(delete=False, dir=data_dir) as temp_file:
|
@@ -29,8 +30,9 @@ def save_uploaded_file(uploaded_file):
|
|
29 |
# Function to save the uploaded image as a temporary file and return its path.
|
30 |
def save_uploaded_image(uploaded_image):
|
31 |
# Create a directory named "images" if it doesn't exist
|
32 |
-
images_dir = "/images"
|
33 |
-
|
|
|
34 |
|
35 |
# Create a temporary file path within the "images" directory with .png extension
|
36 |
temp_file_path = os.path.join(images_dir, tempfile.NamedTemporaryFile(suffix=".png").name)
|
|
|
17 |
file_content = uploaded_file.read() # Load the document
|
18 |
|
19 |
# Create a directory if it doesn't exist
|
20 |
+
# data_dir = "/data"
|
21 |
+
data_dir = "data"
|
22 |
+
os.makedirs(data_dir, exist_ok=True)
|
23 |
|
24 |
# Create a temporary file in the data directory
|
25 |
with tempfile.NamedTemporaryFile(delete=False, dir=data_dir) as temp_file:
|
|
|
30 |
# Function to save the uploaded image as a temporary file and return its path.
|
31 |
def save_uploaded_image(uploaded_image):
|
32 |
# Create a directory named "images" if it doesn't exist
|
33 |
+
# images_dir = "/images"
|
34 |
+
images_dir = "images"
|
35 |
+
os.makedirs(images_dir, exist_ok=True)
|
36 |
|
37 |
# Create a temporary file path within the "images" directory with .png extension
|
38 |
temp_file_path = os.path.join(images_dir, tempfile.NamedTemporaryFile(suffix=".png").name)
|