Ashrafb commited on
Commit
6629a2a
1 Parent(s): 3ea497c

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +1 -1
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.encode()), api_name="/predict") # Encode the string to bytes
21
  return {"sketch_image": result[0]}
22
 
23
  app.mount("/", StaticFiles(directory="static", html=True), name="static")