mgokg commited on
Commit
dc8a913
·
verified ·
1 Parent(s): ede4b3b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -2,7 +2,21 @@ from fastapi import FastAPI
2
  from pydantic import BaseModel
3
  import gradio as gr
4
  import uvicorn
5
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  app = FastAPI()
7
 
8
  class Item(BaseModel):
 
2
  from pydantic import BaseModel
3
  import gradio as gr
4
  import uvicorn
5
+ from fastapi.middleware.cors import CORSMiddleware
6
+ # Liste der Ursprünge, die Zugriff auf die Ressourcen haben sollen
7
+ origins = [ "http://localhost",
8
+ "http://localhost:8000",
9
+ "https://huggingface.co/mgokg",
10
+ # Füge hier weitere Ursprünge hinzu
11
+ ]
12
+
13
+ app.add_middleware(
14
+ CORSMiddleware,
15
+ allow_origins=origins,
16
+ allow_credentials=True,
17
+ allow_methods=["*"],
18
+ allow_headers=["*"],
19
+ )
20
  app = FastAPI()
21
 
22
  class Item(BaseModel):