Spaces:
Runtime error
Runtime error
Create app.py
Browse files
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-Demo"
|
| 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=[['mellizos.jpeg'],['SanMartinUrquiza1944.jpg']]
|
| 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()
|