Spaces:
Runtime error
Runtime error
import streamlit as st | |
import torch | |
import os | |
def getResult(filename): | |
model_name='/content/yolov5/runs/train/exp/weights/best.pt' | |
model = torch.hub.load( "/content/yolov5/",'custom', source='local', path = model_name, force_reload = True) | |
img = "/content/"+filename+"" | |
results = model(img) | |
return results | |
uploaded_file = st.file_uploader("Choose a image file") | |
if uploaded_file is not None: | |
image = uploaded_file.read() | |
filename = uploaded_file.name | |
resulted_img = getResult(filename) | |
img = st.image(resulted_img, caption='Sunrise by the mountains', use_column_width=True) |