Spaces:
Runtime error
Runtime error
JustSkyDev commited on
Commit ·
dd35a77
1
Parent(s): c654282
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,10 @@
|
|
| 1 |
from PIL import Image
|
| 2 |
from fastapi import FastAPI
|
| 3 |
from process import Segment
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
app = FastAPI()
|
| 6 |
|
|
@@ -15,6 +19,6 @@ def process_image(input_image):
|
|
| 15 |
def root_path():
|
| 16 |
return { "log": "Lol" }
|
| 17 |
|
| 18 |
-
@app.
|
| 19 |
-
def api_segment(
|
| 20 |
-
return { "image": process_image(baseImage) }
|
|
|
|
| 1 |
from PIL import Image
|
| 2 |
from fastapi import FastAPI
|
| 3 |
from process import Segment
|
| 4 |
+
from pydantic import BaseModel
|
| 5 |
+
|
| 6 |
+
class SegmentationBody(BaseModel):
|
| 7 |
+
baseImage: str
|
| 8 |
|
| 9 |
app = FastAPI()
|
| 10 |
|
|
|
|
| 19 |
def root_path():
|
| 20 |
return { "log": "Lol" }
|
| 21 |
|
| 22 |
+
@app.post("/api/segment/")
|
| 23 |
+
def api_segment(data: SegmentationBody):
|
| 24 |
+
return { "image": process_image(data.baseImage) }
|