Spaces:
Runtime error
Runtime error
Ajay Harikumar
commited on
Commit
·
4238956
1
Parent(s):
b6f73ba
Change download to gr.File type
Browse files- modules/app.py +2 -10
modules/app.py
CHANGED
@@ -13,17 +13,10 @@ render_factor=35
|
|
13 |
|
14 |
|
15 |
def colorize_image(image):
|
16 |
-
# now = datetime.now().strftime("%Y%m%d-%H%M%S-%f")
|
17 |
if not os.path.exists("./output"):
|
18 |
os.makedirs("./output")
|
19 |
-
# if image is not None:
|
20 |
-
# image.save(f"./output/{now}-input.jpg")
|
21 |
model.predict(image.name)
|
22 |
-
return './output/DeOldify/'+Path(image.name).stem+".png"
|
23 |
-
|
24 |
-
|
25 |
-
def download_image(image):
|
26 |
-
return image
|
27 |
|
28 |
|
29 |
def create_interface():
|
@@ -34,8 +27,7 @@ def create_interface():
|
|
34 |
colorize_button = gr.Button("Colorize!")
|
35 |
colorize_output = gr.Image(type="file")
|
36 |
download_button = gr.Button("Download!")
|
37 |
-
colorize_button.click(colorize_image, inputs=colorize_input, outputs=colorize_output)
|
38 |
-
download_button.click(download_image, inputs=colorize_output, outputs=[])
|
39 |
enhancer.launch()
|
40 |
|
41 |
def run_code():
|
|
|
13 |
|
14 |
|
15 |
def colorize_image(image):
|
|
|
16 |
if not os.path.exists("./output"):
|
17 |
os.makedirs("./output")
|
|
|
|
|
18 |
model.predict(image.name)
|
19 |
+
return './output/DeOldify/'+Path(image.name).stem+".png", './output/DeOldify/'+Path(image.name).stem+".png"
|
|
|
|
|
|
|
|
|
20 |
|
21 |
|
22 |
def create_interface():
|
|
|
27 |
colorize_button = gr.Button("Colorize!")
|
28 |
colorize_output = gr.Image(type="file")
|
29 |
download_button = gr.Button("Download!")
|
30 |
+
colorize_button.click(colorize_image, inputs=colorize_input, outputs=[colorize_output, gr.File(label="Download photo!")],)
|
|
|
31 |
enhancer.launch()
|
32 |
|
33 |
def run_code():
|