Spaces:
Sleeping
Sleeping
Commit
·
ce31921
1
Parent(s):
249a674
add middleware
Browse files
app.py
CHANGED
@@ -8,6 +8,14 @@ import base64
|
|
8 |
|
9 |
app = FastAPI()
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
def get_x(i):
|
12 |
# Convert NumPy array to a single-channel PIL image with inverted colors
|
13 |
return PILImageBW.create(all_noise[i])
|
@@ -23,7 +31,7 @@ learn = load_learner('model.pkl')
|
|
23 |
|
24 |
@app.get("/")
|
25 |
def read_root():
|
26 |
-
html_content = "<p>This is a model inference point for the <a href='https://huggingface.co/spaces/vishalbakshi/isitadigit'>isitadigit</a> space</p>"
|
27 |
return HTMLResponse(content=html_content)
|
28 |
|
29 |
class ImageData(BaseModel):
|
|
|
8 |
|
9 |
app = FastAPI()
|
10 |
|
11 |
+
app.add_middleware(
|
12 |
+
CORSMiddleware,
|
13 |
+
allow_origins=["*"],
|
14 |
+
allow_credentials=True,
|
15 |
+
allow_methods=["*"],
|
16 |
+
allow_headers=["*"],
|
17 |
+
)
|
18 |
+
|
19 |
def get_x(i):
|
20 |
# Convert NumPy array to a single-channel PIL image with inverted colors
|
21 |
return PILImageBW.create(all_noise[i])
|
|
|
31 |
|
32 |
@app.get("/")
|
33 |
def read_root():
|
34 |
+
html_content = "<p>This is a model inference point for the <a href='https://huggingface.co/spaces/vishalbakshi/isitadigit' target='_blank'>isitadigit</a> space</p>"
|
35 |
return HTMLResponse(content=html_content)
|
36 |
|
37 |
class ImageData(BaseModel):
|