Spaces:
Build error
Build error
Update app.py
Browse files16 unmodified lines1718192021222324252627282930313267 unmodified lines10010110210310410530 unmodified lines13613713813914014114215 unmodified lines1581591601611621631641651662 unmodified lines16917017117217317417516 unmodified linesimport tensorflow as tfimport piexifimport piexif.helperimport reTITLE = 'DeepDanbooru String'url = 'https://huggingface.co/spaces/yo2266911/DeepDanbooru_string'matches = re.findall(r'https://huggingface.co/([^/]+)/([^/]+)/([^/]+)', url)repo_id = matches[0][1]repo_type = matches[0][2]MODEL_REPO = f'{repo_id}/{repo_type}'TOKEN = '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'MODEL_FILENAME = 'model-resnet_custom_v3.h5'LABEL_FILENAME = 'tags.txt'67 unmodified linesres[label] = probb = dict(sorted(res.items(),key=lambda item:item[1], reverse=True))a = ', '.join(list(b.keys())).replace('_',' ').replace('(','\(').replace(')','\)')items = rawimage.infogeninfo = ''30 unmodified linesmessage = "Nothing found in the image."info = f"<div><p>{message}<p></div>"return (info,a,res)def main():15 unmodified lineslabel='Score Threshold'),],[gr.outputs.HTML(),gr.outputs.Textbox(label='DeepDanbooru Output (string)'),gr.outputs.Label(label='DeepDanbooru Output (label)')],examples=[['miku.jpg',0.5],2 unmodified linestitle=TITLE,description='''Demo for [KichangKim/DeepDanbooru](https://github.com/KichangKim/DeepDanbooru) with "ready to copy" prompt and a prompt analyzer.Modified from [hysts/DeepDanbooru](https://huggingface.co/spaces/hysts/DeepDanbooru)PNG Info code forked from [AUTOMATIC1111/stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui)''',16 unmodified lines171819202122232425262767 unmodified lines959697989910010130 unmodified lines13213313413513613713815 unmodified lines1541551561571581591601611621632 unmodified lines16616716816917017116 unmodified linesimport tensorflow as tfimport piexifimport piexif.helperTITLE = 'DeepDanbooru String'TOKEN = os.environ['TOKEN']MODEL_REPO = 'NoCrypt/DeepDanbooru_string'MODEL_FILENAME = 'model-resnet_custom_v3.h5'LABEL_FILENAME = 'tags.txt'67 unmodified linesres[label] = probb = dict(sorted(res.items(),key=lambda item:item[1], reverse=True))a = ', '.join(list(b.keys())).replace('_',' ').replace('(','\(').replace(')','\)')c = ', '.join(list(b.keys()))items = rawimage.infogeninfo = ''30 unmodified linesmessage = "Nothing found in the image."info = f"<div><p>{message}<p></div>"return (a,c,res,info)def main():15 unmodified lineslabel='Score Threshold'),],[gr.outputs.Textbox(label='Output (string)'),gr.outputs.Textbox(label='Output (raw string)'),gr.outputs.Label(label='Output (label)'),gr.outputs.HTML()],examples=[['miku.jpg',0.5],2 unmodified linestitle=TITLE,description='''Demo for [KichangKim/DeepDanbooru](https://github.com/KichangKim/DeepDanbooru) with "ready to copy" prompt and a prompt analyzer.Modified from [hysts/DeepDanbooru](https://huggingface.co/spaces/hysts/DeepDanbooru)PNG Info code forked from [AUTOMATIC1111/stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui)''',
app.py+8-12