jayyai commited on
Commit
d2fbc21
·
verified ·
1 Parent(s): a3614b1
Files changed (1) hide show
  1. pdf_route.py +6 -3
pdf_route.py CHANGED
@@ -28,7 +28,8 @@ async def convert_to_markdown(file: UploadFile = File(...)):
28
  content = await file.read()
29
 
30
  # Save the content to a temporary file
31
- temp_pdf_path = "temp.pdf"
 
32
  with open(temp_pdf_path, "wb") as f:
33
  f.write(content)
34
 
@@ -73,7 +74,8 @@ async def convert_to_excel(file: UploadFile = File(...)):
73
  content = await file.read()
74
 
75
  # Save the content to a temporary file
76
- temp_pdf_path = "temp.pdf"
 
77
  with open(temp_pdf_path, "wb") as f:
78
  f.write(content)
79
 
@@ -120,7 +122,8 @@ async def convert_to_word(file: UploadFile = File(...)):
120
  content = await file.read()
121
 
122
  # Save the content to a temporary file
123
- temp_pdf_path = "temp.pdf"
 
124
  with open(temp_pdf_path, "wb") as f:
125
  f.write(content)
126
 
 
28
  content = await file.read()
29
 
30
  # Save the content to a temporary file
31
+ temp_pdf_path = "temp." + file.filename.split('.')[-1]
32
+
33
  with open(temp_pdf_path, "wb") as f:
34
  f.write(content)
35
 
 
74
  content = await file.read()
75
 
76
  # Save the content to a temporary file
77
+ temp_pdf_path = "temp." + file.filename.split('.')[-1]
78
+
79
  with open(temp_pdf_path, "wb") as f:
80
  f.write(content)
81
 
 
122
  content = await file.read()
123
 
124
  # Save the content to a temporary file
125
+ temp_pdf_path = "temp." + file.filename.split('.')[-1]
126
+
127
  with open(temp_pdf_path, "wb") as f:
128
  f.write(content)
129