Neo2902 commited on
Commit
0b1ce94
·
1 Parent(s): 9674a42

Add Playwright to requirements and install browsers at startup

Browse files
Files changed (2) hide show
  1. app.py +4 -2
  2. requirements.txt +1 -1
app.py CHANGED
@@ -1,8 +1,11 @@
 
1
  import sys
2
  import os
3
 
4
- sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
 
5
 
 
6
  import hello_module
7
 
8
  from fastapi import FastAPI
@@ -12,4 +15,3 @@ app = FastAPI()
12
  @app.get("/")
13
  async def root():
14
  return {"message": hello_module.say_hello()}
15
-
 
1
+ import subprocess
2
  import sys
3
  import os
4
 
5
+ # Installer Playwright et ses navigateurs au démarrage (avant import FastAPI)
6
+ subprocess.run(["playwright", "install"], check=True)
7
 
8
+ sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
9
  import hello_module
10
 
11
  from fastapi import FastAPI
 
15
  @app.get("/")
16
  async def root():
17
  return {"message": hello_module.say_hello()}
 
requirements.txt CHANGED
@@ -1,3 +1,3 @@
1
  fastapi
2
  uvicorn
3
-
 
1
  fastapi
2
  uvicorn
3
+ playwright