EasyDetect / app.py
sunnychenxiwang's picture
my app
e1bbae5
raw
history blame
1.52 kB
# 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()
import numpy as np
import gradio as gr
def sepia(input_img):
#处理图像
sepia_filter = np.array([
[0.393, 0.769, 0.189],
[0.349, 0.686, 0.168],
[0.272, 0.534, 0.131]
])
sepia_img = input_img.dot(sepia_filter.T)
sepia_img /= sepia_img.max()
return sepia_img
#shape设置输入图像大小
demo = gr.Interface(sepia, gr.Image(), "image")
demo.launch()