Compare commits
2 Commits
de39a53ee0
...
1b4cec53f5
Author | SHA1 | Date | |
---|---|---|---|
1b4cec53f5 | |||
2aca3657ad |
12
backend.py
12
backend.py
@ -13,7 +13,7 @@ print(torch.cuda.is_available())
|
|||||||
# checkpoint = "sam_vit_b_01ec64.pth"
|
# checkpoint = "sam_vit_b_01ec64.pth"
|
||||||
print(time.time())
|
print(time.time())
|
||||||
# set large model related configs
|
# set large model related configs
|
||||||
checkpoint = "sam_vit_h_4b8939.pth"
|
checkpoint = "notebooks/sam_vit_h_4b8939.pth"
|
||||||
model_type = "vit_h"
|
model_type = "vit_h"
|
||||||
sam = sam_model_registry[model_type](checkpoint=checkpoint)
|
sam = sam_model_registry[model_type](checkpoint=checkpoint)
|
||||||
sam.to(device='cuda')
|
sam.to(device='cuda')
|
||||||
@ -51,9 +51,13 @@ def index():
|
|||||||
np.save("array.npy", image_embedding)
|
np.save("array.npy", image_embedding)
|
||||||
response = Response(byte_io, mimetype="application/octet-stream")
|
response = Response(byte_io, mimetype="application/octet-stream")
|
||||||
response.headers["Content-Length"] = 4194432
|
response.headers["Content-Length"] = 4194432
|
||||||
|
response.headers["Access-Control-Allow-Origin"] = "*"
|
||||||
return response
|
return response
|
||||||
else:
|
else:
|
||||||
return 'Content-Type not supported!'
|
return 'Content-Type not supported!'
|
||||||
|
|
||||||
|
|
||||||
print('server starts working')
|
print('server starts working')
|
||||||
|
|
||||||
|
|
||||||
|
app.run('0.0.0.0', 2020, False)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user