Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -67,6 +67,21 @@ def fx6(img, lang):
|
|
67 |
im_show = Image.fromarray(im_show)
|
68 |
im_show.save('result.jpg')
|
69 |
return 'result.jpg'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
|
72 |
with demo:
|
@@ -101,6 +116,10 @@ with demo:
|
|
101 |
ocr_input=[gr.Image(type='file', label='请提供你需要识别的照片'),gr.Dropdown(choices=['中文','英文','法文','德文','韩文','日文'], type="value", default='中文', label='请选择需要识别的语言')]
|
102 |
ocr_output=gr.Image(type='file', label='识别结果')
|
103 |
ocr_button = gr.Button("开始ocr识别")
|
|
|
|
|
|
|
|
|
104 |
|
105 |
tj_button.click(fx1, inputs=text_input, outputs=text_output)
|
106 |
cs_button.click(fx2, inputs=val_input, outputs=json_output,api_name="ghqj")
|
@@ -108,5 +127,6 @@ with demo:
|
|
108 |
tts_button.click(fx4, inputs=TS_input, outputs=audio_output)
|
109 |
pva_button.click(fx5, inputs=[],outputs=pva_output)
|
110 |
ocr_button.click(fx6,inputs=ocr_input,outputs=ocr_output)
|
|
|
111 |
|
112 |
demo.launch(enable_queue=True)
|
|
|
67 |
im_show = Image.fromarray(im_show)
|
68 |
im_show.save('result.jpg')
|
69 |
return 'result.jpg'
|
70 |
+
|
71 |
+
model2 = torch.hub.load(
|
72 |
+
"AK391/animegan2-pytorch:main",
|
73 |
+
"generator",
|
74 |
+
pretrained=True,
|
75 |
+
device="cuda",
|
76 |
+
progress=False
|
77 |
+
)
|
78 |
+
face2paint = torch.hub.load(
|
79 |
+
'AK391/animegan2-pytorch:main', 'face2paint',
|
80 |
+
size=512, device="cuda",side_by_side=False
|
81 |
+
)
|
82 |
+
def fx7(img):
|
83 |
+
out = face2paint(model2, img)
|
84 |
+
return out
|
85 |
|
86 |
|
87 |
with demo:
|
|
|
116 |
ocr_input=[gr.Image(type='file', label='请提供你需要识别的照片'),gr.Dropdown(choices=['中文','英文','法文','德文','韩文','日文'], type="value", default='中文', label='请选择需要识别的语言')]
|
117 |
ocr_output=gr.Image(type='file', label='识别结果')
|
118 |
ocr_button = gr.Button("开始ocr识别")
|
119 |
+
with gr.TabItem("风格迁移"):
|
120 |
+
qy_input=gr.Image(type="pil",label="请选择需要风格迁移的照片",show_label=True)
|
121 |
+
qy_output=gr.Image(type="pil",label="输出迁移风格结果",show_label=True)
|
122 |
+
qy_button = gr.Button("开始调用模型")
|
123 |
|
124 |
tj_button.click(fx1, inputs=text_input, outputs=text_output)
|
125 |
cs_button.click(fx2, inputs=val_input, outputs=json_output,api_name="ghqj")
|
|
|
127 |
tts_button.click(fx4, inputs=TS_input, outputs=audio_output)
|
128 |
pva_button.click(fx5, inputs=[],outputs=pva_output)
|
129 |
ocr_button.click(fx6,inputs=ocr_input,outputs=ocr_output)
|
130 |
+
qy_button.click(fx7,inputs=qy_input,outputs=qy_output)
|
131 |
|
132 |
demo.launch(enable_queue=True)
|