update
This commit is contained in:
parent
2e78802f33
commit
79ffcae3d6
|
@ -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 = "<p style='text-align: center'><a href='https://github.com/bryandlee/animegan2-pytorch' target='_blank'>Github Repo Pytorch</a></p> <center><img src='https://visitor-badge.glitch.me/badge?page_id=akhaliq_animegan' alt='visitor badge'></center></p>"
|
||||
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()
|
||||
|
|
Loading…
Reference in New Issue