Update BrainBot.py
Browse files- BrainBot.py +3 -1
BrainBot.py
CHANGED
|
@@ -14,14 +14,16 @@ st.markdown(f'<style>{css}</style>', unsafe_allow_html=True)
|
|
| 14 |
## -------------------------------------------------------------------------------------------
|
| 15 |
# Function to save the uploaded file as a temporary file and return its path.
|
| 16 |
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 |
# os.makedirs(data_dir, exist_ok=True)
|
| 22 |
|
| 23 |
# Create a temporary file in the data directory
|
| 24 |
with tempfile.NamedTemporaryFile(delete=False, dir=data_dir) as temp_file:
|
|
|
|
| 25 |
temp_file.write(file_content) # Write the uploaded file content to the temporary file
|
| 26 |
temp_file_path = temp_file.name # Get the path of the temporary file
|
| 27 |
return temp_file_path
|
|
|
|
| 14 |
## -------------------------------------------------------------------------------------------
|
| 15 |
# Function to save the uploaded file as a temporary file and return its path.
|
| 16 |
def save_uploaded_file(uploaded_file):
|
| 17 |
+
st.write("Inside func")
|
| 18 |
file_content = uploaded_file.read() # Load the document
|
| 19 |
+
st.write("read file")
|
| 20 |
# Create a directory if it doesn't exist
|
| 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:
|
| 26 |
+
st.write("writing file...")
|
| 27 |
temp_file.write(file_content) # Write the uploaded file content to the temporary file
|
| 28 |
temp_file_path = temp_file.name # Get the path of the temporary file
|
| 29 |
return temp_file_path
|