Spaces:
Runtime error
Runtime error
geraltofrivia
commited on
Commit
•
20483d5
1
Parent(s):
53d8cf5
Create app.py (#1)
Browse files- Create app.py (4507a7c0a949ea7472c3a71da8b2f5b8d02c3496)
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
os.system("hub install deoldify==1.0.1")
|
3 |
+
import gradio as gr
|
4 |
+
import paddlehub as hub
|
5 |
+
from pathlib import Path
|
6 |
+
|
7 |
+
|
8 |
+
model = hub.Module(name='deoldify')
|
9 |
+
|
10 |
+
def inference(image):
|
11 |
+
model.predict(image.name)
|
12 |
+
return './output/DeOldify/'+Path(image.name).stem+".png"
|
13 |
+
|
14 |
+
title = "DeOldify"
|
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 |
+
|
18 |
+
examples=[['lunch.jpeg']]
|
19 |
+
iface = gr.Interface(inference, inputs=gr.inputs.Image(type="file"), outputs=gr.outputs.Image(type="file"),examples=examples,enable_queue=True,title=title,article=article,description=description)
|
20 |
+
iface.launch()
|