Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -71,10 +71,12 @@ async def convert_file(
|
|
| 71 |
detail="Invalid color format. Use 6-character hex code (e.g., '5FFFDF')"
|
| 72 |
)
|
| 73 |
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
|
|
|
|
|
|
| 78 |
|
| 79 |
output_filename = file.filename.replace('.xlsx', '_converted.docx')
|
| 80 |
temp_output_path = tempfile.mktemp(suffix='.docx')
|
|
|
|
| 71 |
detail="Invalid color format. Use 6-character hex code (e.g., '5FFFDF')"
|
| 72 |
)
|
| 73 |
|
| 74 |
+
original_name = Path(file.filename).stem
|
| 75 |
+
temp_dir = tempfile.mkdtemp()
|
| 76 |
+
temp_input_path = os.path.join(temp_dir, f"{original_name}.xlsx")
|
| 77 |
+
|
| 78 |
+
with open(temp_input_path, "wb") as f:
|
| 79 |
+
f.write(await file.read())
|
| 80 |
|
| 81 |
output_filename = file.filename.replace('.xlsx', '_converted.docx')
|
| 82 |
temp_output_path = tempfile.mktemp(suffix='.docx')
|