Hugo Rodrigues commited on
Commit
5304529
·
1 Parent(s): ea61a65

update app

Browse files
Files changed (1) hide show
  1. main.py +10 -1
main.py CHANGED
@@ -5,13 +5,22 @@
5
  from typing import Union
6
  from pydantic import BaseModel
7
  from fastapi import FastAPI
 
8
 
9
  from fastapi.staticfiles import StaticFiles
10
  from fastapi.responses import FileResponse
11
 
12
  from transformers import pipeline
13
 
14
- app = FastAPI()
 
 
 
 
 
 
 
 
15
 
16
  pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
17
 
 
5
  from typing import Union
6
  from pydantic import BaseModel
7
  from fastapi import FastAPI
8
+ from fastapi.middleware.cors import CORSMiddleware
9
 
10
  from fastapi.staticfiles import StaticFiles
11
  from fastapi.responses import FileResponse
12
 
13
  from transformers import pipeline
14
 
15
+ app = FastAPI(docs_url="/api/docs")
16
+
17
+ app.add_middleware(
18
+ CORSMiddleware,
19
+ allow_origins=["*"],
20
+ allow_methods=["*"],
21
+ allow_headers=["*"],
22
+ allow_credentials=True,
23
+ )
24
 
25
  pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
26