Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -40,12 +40,25 @@ def check_file(file, suffix=''):
|
|
40 |
st.title("Hololive Waifu Classification")
|
41 |
|
42 |
image = st.text_input('Image URL', '')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
-
if
|
45 |
image = check_file(image)
|
46 |
input_image = Image.open(image)
|
47 |
model = torch.hub.load('ultralytics/yolov5', 'custom', path='best.pt')
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
for img in results.render():
|
50 |
st.image(img)
|
51 |
-
st.write(results.pandas().xyxy[0])
|
|
|
40 |
st.title("Hololive Waifu Classification")
|
41 |
|
42 |
image = st.text_input('Image URL', '')
|
43 |
+
imgsz = st.text_input('Image Size', 1280)
|
44 |
+
conf = st.text_input('Confidence threshold', 0.25)
|
45 |
+
iou = st.text_input('IoU threshold', 0.45)
|
46 |
+
multi_label = st.selectbox('Multiple labels per box', (False, True))
|
47 |
+
agnostic = st.selectbox('Class-agnostic', (False, True))
|
48 |
+
amp = st.selectbox('Automatic Mixed Precision inference', (False, True))
|
49 |
+
max_det = st.text_input('Maximum number of detections per image', 1000)
|
50 |
|
51 |
+
if st.button('Excute'):
|
52 |
image = check_file(image)
|
53 |
input_image = Image.open(image)
|
54 |
model = torch.hub.load('ultralytics/yolov5', 'custom', path='best.pt')
|
55 |
+
model.conf = float(conf)
|
56 |
+
model.max_det = int(max_det)
|
57 |
+
model.iou = float(iou)
|
58 |
+
model.agnostic = agnostic
|
59 |
+
model.multi_label = multi_label
|
60 |
+
model.amp = amp
|
61 |
+
results = model(input_image, size=int(imgsz))
|
62 |
for img in results.render():
|
63 |
st.image(img)
|
64 |
+
st.write(results.pandas().xyxy[0])
|