Spaces:
Sleeping
Sleeping
import gradio as gr | |
# import sys | |
# sys.path.append("/home/wcx/wcx/EasyDetect/pipeline") | |
# from run import * | |
# ''' | |
# 把一些文件移动到此文件路径下 | |
# ''' | |
# text = "A person is cutting a birthday cake with two red candles that spell out \"21\". The surface of the cake is round, and there is a balloon in the room. The person is using a silver knife to cut the cake." | |
# image_path = "/newdisk3/wcx/val2014/COCO_val2014_000000297425.jpg" | |
# pipeline = Pipeline() | |
# res = pipeline.run(text=text, image_path=image_path) | |
# def greet(name, cnt): | |
# return "Hello " * cnt + name + "!" | |
# demo = gr.Interface( | |
# fn=greet, | |
# inputs=["text", "slider"], | |
# outputs=["text"], | |
# ) | |
# demo.launch() | |
def generate_mutimodal(title, context, img): | |
return f"Title:{title}\nContext:{context}\n...{img}" | |
server = gr.Interface( | |
fn=generate_mutimodal, | |
inputs=[ | |
gr.Textbox(lines=1, placeholder="请输入标题"), | |
gr.Textbox(lines=2, placeholder="请输入正文"), | |
gr.Image(shape=(200, 200), label="请上传图片(可选)") | |
], | |
outputs="text" | |
) | |
server.launch() | |