Spaces:
Runtime error
Runtime error
commit
Browse files
app.py
CHANGED
|
@@ -53,17 +53,17 @@ def main():
|
|
| 53 |
parameter_values["dsafadsfnt"] = "SDSDSDS"
|
| 54 |
|
| 55 |
# run the file update
|
| 56 |
-
|
| 57 |
|
| 58 |
# Save button
|
| 59 |
if st.button('Save Changes'):
|
| 60 |
base_name, extension = selected_file.split(".")
|
| 61 |
# new_filename = f"{base_name}_modified{extension}"
|
| 62 |
-
new_filename = "LOI_ADDRESS_DATE_modified
|
| 63 |
modified_doc.save(new_filename)
|
| 64 |
-
|
| 65 |
# st.success('File saved successfully!')
|
| 66 |
-
st.success(
|
| 67 |
|
| 68 |
# Function to replace parameters in file content with provided values
|
| 69 |
def replace_text_in_docx(docx_file, replacements):
|
|
@@ -77,7 +77,7 @@ def replace_text_in_docx(docx_file, replacements):
|
|
| 77 |
if search_text in inline[i].text:
|
| 78 |
text = inline[i].text.replace(search_text, replace_text)
|
| 79 |
inline[i].text = text
|
| 80 |
-
return
|
| 81 |
|
| 82 |
# Function to replace parameters in file content with provided values
|
| 83 |
def replace_parameters(file_contents, parameter_values):
|
|
|
|
| 53 |
parameter_values["dsafadsfnt"] = "SDSDSDS"
|
| 54 |
|
| 55 |
# run the file update
|
| 56 |
+
modified_doc = replace_text_in_docx(selected_file, parameter_values)
|
| 57 |
|
| 58 |
# Save button
|
| 59 |
if st.button('Save Changes'):
|
| 60 |
base_name, extension = selected_file.split(".")
|
| 61 |
# new_filename = f"{base_name}_modified{extension}"
|
| 62 |
+
new_filename = "LOI_ADDRESS_DATE_modified"
|
| 63 |
modified_doc.save(new_filename)
|
| 64 |
+
docww = (modified_doc.paragraphs[1].text[:22])
|
| 65 |
# st.success('File saved successfully!')
|
| 66 |
+
st.success(docww)
|
| 67 |
|
| 68 |
# Function to replace parameters in file content with provided values
|
| 69 |
def replace_text_in_docx(docx_file, replacements):
|
|
|
|
| 77 |
if search_text in inline[i].text:
|
| 78 |
text = inline[i].text.replace(search_text, replace_text)
|
| 79 |
inline[i].text = text
|
| 80 |
+
return doc
|
| 81 |
|
| 82 |
# Function to replace parameters in file content with provided values
|
| 83 |
def replace_parameters(file_contents, parameter_values):
|