cafeai commited on
Commit
98dbf51
1 Parent(s): d3119f5

waifu demo

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -19,4 +19,13 @@ def style(input_img):
19
  return final
20
  demo_style = gr.Interface(fn=style, inputs=gr.Image(type="pil"), outputs=gr.Label(label="style"))
21
 
22
- gr.Parallel(demo_aesthetic, demo_style).launch()
 
 
 
 
 
 
 
 
 
 
19
  return final
20
  demo_style = gr.Interface(fn=style, inputs=gr.Image(type="pil"), outputs=gr.Label(label="style"))
21
 
22
+ pipe_waifu = pipeline("image-classification", "cafeai/cafe_waifu")
23
+ def waifu(input_img):
24
+ data = pipe_waifu(input_img, top_k=5)
25
+ final = {}
26
+ for d in data:
27
+ final[d["label"]] = d["score"]
28
+ return final
29
+ demo_waifu = gr.Interface(fn=waifu, inputs=gr.Image(type="pil"), outputs=gr.Label(label="waifu"))
30
+
31
+ gr.Parallel(demo_aesthetic, demo_style, demo_waifu).launch()