diff --git a/git_large_coco/app.py b/git_large_coco/app.py index 079c684..67d4ad1 100644 --- a/git_large_coco/app.py +++ b/git_large_coco/app.py @@ -15,46 +15,20 @@ def inference(img): return generated_caption title = "Image to text:git-large-coco" -description = "Gradio Demo for git-large-coco. To use it, simply upload your image, or click one of the examples to load them." article = "

Github Repo Pytorch

visitor badge

" examples=[['example_cat.jpg'],['Masahiro.png']] -demo = gr.Interface( - fn=inference, - inputs=[gr.inputs.Image(type="pil")], - outputs=gr.outputs.Textbox(), - title=title, - description=description, - article=article, - examples=examples) +with gr.Blocks() as demo: + gr.Markdown( + """ + # Image to text:git-large-coco + 这是一个git-large-coco的Gradio Demo。 上传你想要的图像或者点击下面的示例来加载它。 + """) + with gr.Row(): + text_input = gr.Image() + text_output = gr.Textbox() + image_button = gr.Button("上传") + image_button.click(inference, inputs=text_input, outputs=text_output) + gr.Examples(examples, inputs=text_input) -demo.launch(server_name="0.0.0.0") - - -## - - -# model_dir = "hub/animegan2-pytorch-main" -# model_dir_weight = "hub/checkpoints/face_paint_512_v1.pt" -# -# model2 = torch.hub.load( -# model_dir, -# "generator", -# pretrained=True, -# progress=False, -# source="local" -# ) -# model1 = torch.load(model_dir_weight) -# face2paint = torch.hub.load( -# model_dir, 'face2paint', -# size=512,side_by_side=False, -# source="local" -# ) -# -# def inference(img, ver): -# if ver == 'version 2 (🔺 robustness,🔻 stylization)': -# out = face2paint(model2, img) -# else: -# out = face2paint(model1, img) -# return out -# +demo.launch()