Spaces:
Sleeping
Sleeping
Commit
·
ad4956a
1
Parent(s):
5076732
my app
Browse files
app.py
CHANGED
|
@@ -1,12 +1,38 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
)
|
| 11 |
|
| 12 |
-
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
# import sys
|
| 3 |
+
# sys.path.append("/home/wcx/wcx/EasyDetect/pipeline")
|
| 4 |
|
| 5 |
+
# from run import *
|
| 6 |
+
# '''
|
| 7 |
+
# 把一些文件移动到此文件路径下
|
| 8 |
+
# '''
|
| 9 |
+
# 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."
|
| 10 |
+
# image_path = "/newdisk3/wcx/val2014/COCO_val2014_000000297425.jpg"
|
| 11 |
+
# pipeline = Pipeline()
|
| 12 |
+
# res = pipeline.run(text=text, image_path=image_path)
|
| 13 |
|
| 14 |
+
# def greet(name, cnt):
|
| 15 |
+
# return "Hello " * cnt + name + "!"
|
| 16 |
+
|
| 17 |
+
# demo = gr.Interface(
|
| 18 |
+
# fn=greet,
|
| 19 |
+
# inputs=["text", "slider"],
|
| 20 |
+
# outputs=["text"],
|
| 21 |
+
# )
|
| 22 |
+
|
| 23 |
+
# demo.launch()
|
| 24 |
+
|
| 25 |
+
def generate_mutimodal(title, context, img):
|
| 26 |
+
return f"Title:{title}\nContext:{context}\n...{img}"
|
| 27 |
+
|
| 28 |
+
server = gr.Interface(
|
| 29 |
+
fn=generate_mutimodal,
|
| 30 |
+
inputs=[
|
| 31 |
+
gr.Textbox(lines=1, placeholder="请输入标题"),
|
| 32 |
+
gr.Textbox(lines=2, placeholder="请输入正文"),
|
| 33 |
+
gr.Image(shape=(200, 200), label="请上传图片(可选)")
|
| 34 |
+
],
|
| 35 |
+
outputs="text"
|
| 36 |
)
|
| 37 |
|
| 38 |
+
server.launch()
|