Ahsen Khaliq commited on
Commit
7980082
·
1 Parent(s): 369cbd4

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import cv2
3
+ os.system("hub install UGATIT_100w==1.0.0")
4
+ import gradio as gr
5
+ import paddlehub as hub
6
+
7
+ model = hub.Module(name='UGATIT_100w', use_gpu=False)
8
+
9
+ def inference(image):
10
+ model.predict(image.name)
11
+ result = model.style_transfer(images=[cv2.imread(image.name)])
12
+ return result
13
+
14
+ title = "UGATIT-selfie2anime"
15
+ description = "Gradio demo for DeOldify. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
16
+ article = "<p style='text-align: center'><a href='https://github.com/jantic/DeOldify' target='_blank'>Github Repo</a></p>"
17
+ examples=[['lunch.jpeg']]
18
+ iface = gr.Interface(inference, inputs=gr.inputs.Image(type="file"), outputs=gr.outputs.Image(type="numpy"),examples=examples,enable_queue=True,title=title,article=article,description=description)
19
+ iface.launch()