Overview

In the following article, I introduced an inference app using Hugging Face Spaces and a YOLOv5 model trained on the NDL-DocL dataset.

This app had stopped working, so I fixed it to make it operational again.

https://huggingface.co/spaces/nakamura196/yolov5-ndl-layout

Here are my notes on the changes made during this fix.

Changes

The modified app.py is shown below.

ifiimdio]tdae]ddmrmmoenuierxeepoppdfpttstammomooeuplcimoorrrlyrdri#or]tuggercp[[[.tPttoefemuestrrill'''=lI=lss_Ctts..=peeagLyjou=wopu=IJtsgurosy(l=inuror=mS"i=rnailooitrtvtnuegaOYo=.cdmonlmsejhe_tsr[gNOn"Ihipvo)ss_ri[p.e(L<[n(oo5v:=uobtmuI()O=p(((tsr5lnoatmtvehat.mt.xtg_ay5"sraslosleheigpYtfrIod.osemeeNOyaegmaepa=a(=DLlc=radlad=ngt"LOeeFg((nsuIeyp-v=)(ae"id(rmm,piD5'.ylnmadepaelotjosa)sfsyg="cNeplek()ue',LDxg)o)a)la.pLt)'.,m#.trfilD--.]juxsrrlaaDaj,piriy.ao'btolpgnanxrym,eacig'p1fyealsLg']u9e[nbrl=en]t6r0dara"tD:,s/e]ecabOsa,yn.rkyeu"tcoct((ltaeoleo)ti=psnuo_[om"uettvj0_Ottep5s]awrsru-oniiI'tnntgmG>sd(#ihiarY,lom_ngaO-rrabaedLtliegol"iOiaesex)ovtynueI,5lotlsmdeu=t)aeN=t"sgmDt"r.eoLi)er"-tce)fDlonooerdrc,deLsrod"(bDe))jasetcrcaretsitepudttresintoseincs=atdiaelonsincs.ortbiUjpopetflciotoianmdd,aegataenersctitimicaolgnee=maoorrdteiclcllitecr,kaieanxneadmepxolanemspt=lheeexai<mmapalgheerse)tf=u"shet.t"ps://github.com/ndl-lab/layout-dataset\">NDL-DocLDatasets</a>.</p>"

First, due to Gradio version upgrades, I changed gr.inputs.Image to gr.Image and similar updates.

I also modified the code to use the following yolov5 library.

https://pypi.org/project/yolov5/

Furthermore, I updated it to use the model hosted on Hugging Face as follows. (Previously, a locally downloaded model was being loaded.)

yolov5.load(“nakamura196/yolov5-ndl-layout”)

As a result, the model page now shows the Spaces where this model is being used. The model description is currently insufficient and will be updated in the future.

https://huggingface.co/nakamura196/yolov5-ndl-layout

Summary

There are many areas that could be improved, but I hope some parts are helpful as a reference.