Spaces:
Runtime error
Runtime error
fix: bug
Browse files
app.py
CHANGED
@@ -2,16 +2,6 @@ import gradio as gr
|
|
2 |
import torch
|
3 |
from PIL import Image, ImageDraw
|
4 |
import json
|
5 |
-
import csv
|
6 |
-
|
7 |
-
# Increase the maximum field size limit
|
8 |
-
OVER_SIZE_LIMIT = 200_000_000
|
9 |
-
|
10 |
-
csv.field_size_limit(OVER_SIZE_LIMIT)
|
11 |
-
|
12 |
-
# Images
|
13 |
-
torch.hub.download_url_to_file('https://www.dl.ndl.go.jp/api/iiif/2586696/R0000008/full/1024,/0/default.jpg', '2586696_R0000008.jpg')
|
14 |
-
torch.hub.download_url_to_file('https://www.dl.ndl.go.jp/api/iiif/2586696/R0000009/full/1024,/0/default.jpg', '2586696_R0000009.jpg')
|
15 |
|
16 |
# Model
|
17 |
model = torch.hub.load('ultralytics/yolov5', 'custom', path='best.pt', source="local")
|
@@ -61,7 +51,7 @@ title = "YOLOv5 Kunshujo"
|
|
61 |
description = "YOLOv5 Kunshujo Gradio demo for object detection. Upload an image or click an example image to use."
|
62 |
article = "<p style='text-align: center'>YOLOv5 Kunshujo is an object detection model trained on the <a href=\"https://github.com/utda/kunshujo-layout-dataset\">Kunshujo layout dataset</a>.</p>"
|
63 |
|
64 |
-
examples = [['2586696_R0000008.jpg']
|
65 |
demo = gr.Interface(yolo, inputs, outputs, title=title, description=description, article=article, examples=examples)
|
66 |
|
67 |
demo.launch()
|
|
|
2 |
import torch
|
3 |
from PIL import Image, ImageDraw
|
4 |
import json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
# Model
|
7 |
model = torch.hub.load('ultralytics/yolov5', 'custom', path='best.pt', source="local")
|
|
|
51 |
description = "YOLOv5 Kunshujo Gradio demo for object detection. Upload an image or click an example image to use."
|
52 |
article = "<p style='text-align: center'>YOLOv5 Kunshujo is an object detection model trained on the <a href=\"https://github.com/utda/kunshujo-layout-dataset\">Kunshujo layout dataset</a>.</p>"
|
53 |
|
54 |
+
examples = [['2586696_R0000008.jpg']]
|
55 |
demo = gr.Interface(yolo, inputs, outputs, title=title, description=description, article=article, examples=examples)
|
56 |
|
57 |
demo.launch()
|