akhaliq HF staff commited on
Commit
37c8c8d
1 Parent(s): edca1c8

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import cv2
3
+ import paddlehub as hub
4
+ from PIL import Image
5
+ import numpy as np
6
+
7
+ model = hub.Module(name='animegan_v2_paprika_97', use_gpu=False)
8
+
9
+
10
+ def inference(img):
11
+ result = model.style_transfer(images=[cv2.imread(img)])
12
+ return result[0][:,:,::-1]
13
+
14
+
15
+ title="animegan_v2_paprika_97"
16
+ description="AnimeGAN V2 image style conversion model, the model can convert the input image into the red pepper anime style, and the model weights are converted from the AnimeGAN V2 official open source project ."
17
+
18
+ examples=[['city.jpeg']]
19
+ gr.Interface(inference,gr.inputs.Image(type="filepath"),gr.outputs.Image(type="numpy"),title=title,description=description,examples=examples).launch(enable_queue=True)