Update main.py
Browse files
main.py
CHANGED
|
@@ -17,7 +17,7 @@ client = Client("https://ashrafb-image-to-sketch.hf.space/", hf_token=hf_token)
|
|
| 17 |
@app.post("/upload/")
|
| 18 |
async def upload_file(file: UploadFile = File(...)):
|
| 19 |
contents = await file.read()
|
| 20 |
-
result = client.predict(contents, api_name="/predict")
|
| 21 |
return {"sketch_image": result[0]}
|
| 22 |
|
| 23 |
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
|
|
|
| 17 |
@app.post("/upload/")
|
| 18 |
async def upload_file(file: UploadFile = File(...)):
|
| 19 |
contents = await file.read()
|
| 20 |
+
result = client.predict(io.BytesIO(contents), api_name="/predict") # Pass the image data as bytes-like object
|
| 21 |
return {"sketch_image": result[0]}
|
| 22 |
|
| 23 |
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|