Spaces:
Runtime error
Runtime error
import os | |
import gradio as gr | |
from PIL import Image | |
import torch | |
os.system('mkdir weights') | |
os.system('curl -L -o weights/hybridnets.pth https://github.com/datvuthanh/HybridNets/releases/download/v1.0/hybridnets.pth') | |
def inference(img): | |
img = img.resize((1280,720)) | |
img.save("demo/image/1.jpg", "JPEG") | |
#os.system('python hybridnets_test.py -w weights/hybridnets.pth --source demo/image --output demo_result --imshow False --imwrite True --cuda False') | |
os.system('python hybridnets_test.py -w weights/hybridnets.pth --source demo/image --output demo_result --imshow False --imwrite True --cuda False --float16 False') | |
return 'demo_result/0.jpg' | |
title="HybridNets Demo" | |
description="Gradio demo for HybridNets: End2End Perception Network pretrained on BDD100k Dataset. To use it, simply upload your image or click on one of the examples to load them. Read more at the links below" | |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2203.09035' target='_blank'>ybridNets: End2End Perception Network</a> | <a href='https://github.com/datvuthanh/HybridNets' target='_blank'>Github Repo</a></p>" | |
examples=[['1.jpg'],['2.jpg'],['3.jpg']] | |
gr.Interface( | |
inference, | |
[gr.inputs.Image(type="pil", label="Input")], | |
gr.outputs.Image(type="file", label="Output"), | |
title=title, | |
description=description, | |
article=article, | |
enable_queue=True, | |
examples=examples | |
).launch(debug=True) |