Spaces:
Build error
Build error
Update app.py
Browse files16 unmodified lines17181920202122242526272829232425262767 unmodified lines959697989910010130 unmodified lines13213313413913513613713815 unmodified lines1541551561611621631571581591601611621632 unmodified lines16616716817216917017116 unmodified linesimport tensorflow as tfimport piexifimport piexif.helperimport re
TITLE = '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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'TOKEN = os.environ['TOKEN']MODEL_REPO = 'NoCrypt/DeepDanbooru_string'MODEL_FILENAME = 'model-resnet_custom_v3.h5'LABEL_FILENAME = 'tags.txt'
67 unmodified lines res[label] = prob b = 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.info geninfo = ''30 unmodified lines message = "Nothing found in the image." info = f"<div><p>{message}<p></div>" return (info,a,res) return (a,c,res,info)
def main():15 unmodified lines label='Score Threshold'), ], [ gr.outputs.HTML(), gr.outputs.Textbox(label='DeepDanbooru Output (string)'), gr.outputs.Label(label='DeepDanbooru Output (label)') 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 lines title=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