Spaces:
Runtime error
Runtime error
Use components and output path.
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
import random
|
3 |
from random import randint
|
@@ -17,9 +18,13 @@ def inference(img):
|
|
17 |
#INPUT_DIR = "/tmp/input_image" + str(_id) + "/"
|
18 |
OUTPUT_DIR = "/tmp/output_image" + str(_id) + "/"
|
19 |
img.save(OUTPUT_DIR + "1.jpg", "JPEG")
|
|
|
|
|
|
|
|
|
20 |
|
21 |
gr.Interface(
|
22 |
inference,
|
23 |
-
|
24 |
-
|
25 |
).launch()
|
|
|
1 |
+
import os
|
2 |
import gradio as gr
|
3 |
import random
|
4 |
from random import randint
|
|
|
18 |
#INPUT_DIR = "/tmp/input_image" + str(_id) + "/"
|
19 |
OUTPUT_DIR = "/tmp/output_image" + str(_id) + "/"
|
20 |
img.save(OUTPUT_DIR + "1.jpg", "JPEG")
|
21 |
+
return os.path.join(OUTPUT_DIR, "1_out.jpg")
|
22 |
+
|
23 |
+
input_image = gr.inputs.Image(type="pil", label="Input")
|
24 |
+
output_image = gr.outputs.Image(type="file", label="Output")
|
25 |
|
26 |
gr.Interface(
|
27 |
inference,
|
28 |
+
inputs=[input_image],
|
29 |
+
outputs=[output_image]
|
30 |
).launch()
|