andregprospero commited on
Commit
452949c
·
verified ·
1 Parent(s): 58d55eb

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -24
app.py DELETED
@@ -1,24 +0,0 @@
1
- from fastapi import FastAPI, Request
2
- from fastapi.responses import FileResponse
3
- from docxtpl import DocxTemplate
4
- from pathlib import Path
5
- import uuid
6
-
7
- app = FastAPI()
8
-
9
- @app.post("/generate-pop")
10
- async def generate_pop(request: Request):
11
- data = await request.json()
12
-
13
- doc = DocxTemplate("Modelo_POP_v1.docx")
14
- doc.render(data)
15
-
16
- filename = f"POP_{uuid.uuid4().hex[:8]}.docx"
17
- filepath = Path(filename)
18
- doc.save(filepath)
19
-
20
- return FileResponse(
21
- path=filepath,
22
- media_type="application/vnd.openxmlformats-officedocument.wordprocessingml.document",
23
- filename=filename
24
- )