Spaces:
Sleeping
Sleeping
File size: 1,114 Bytes
225738c ad4956a 225738c ad4956a 225738c ad4956a d89f3e5 ad4956a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
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()
|