Spaces:
Runtime error
Runtime error
starting on upload image functionality
Browse files
app.py
CHANGED
@@ -10,6 +10,7 @@ from os.path import exists, dirname
|
|
10 |
import sys
|
11 |
import json
|
12 |
import flask
|
|
|
13 |
|
14 |
parent_dir = dirname(os.path.abspath(os.getcwd()))
|
15 |
sys.path.append(parent_dir)
|
@@ -31,11 +32,15 @@ def get_image_data(image_name):
|
|
31 |
def segmentation_generation(image_name, c_width, n_top, n_gif_imgs):
|
32 |
print("Inputs Received:", image_name, c_width, n_top, n_gif_imgs)
|
33 |
|
|
|
|
|
|
|
|
|
34 |
# cred_width = c_width
|
35 |
# n_top_segs = n_top
|
36 |
# n_gif_images = n_gif_imgs
|
37 |
image, model_and_data = get_image_data(image_name)
|
38 |
-
print("model_and_data", model_and_data)
|
39 |
# Unpack datax
|
40 |
xtest = model_and_data["xtest"]
|
41 |
ytest = model_and_data["ytest"]
|
@@ -86,7 +91,8 @@ if __name__ == "__main__":
|
|
86 |
# gradio's image inputs look like this: <PIL.Image.Image image mode=RGB size=305x266 at 0x7F3D01C91FA0>
|
87 |
# need to learn how to handle image inputs, or deal with file inputs or just file path strings
|
88 |
inp = gr.inputs.Textbox(lines=1, placeholder="Select an example from below", default="", label="Input Image Path", optional=False)
|
89 |
-
out =
|
|
|
90 |
|
91 |
iface = gr.Interface(
|
92 |
segmentation_generation,
|
|
|
10 |
import sys
|
11 |
import json
|
12 |
import flask
|
13 |
+
from PIL import Image
|
14 |
|
15 |
parent_dir = dirname(os.path.abspath(os.getcwd()))
|
16 |
sys.path.append(parent_dir)
|
|
|
32 |
def segmentation_generation(image_name, c_width, n_top, n_gif_imgs):
|
33 |
print("Inputs Received:", image_name, c_width, n_top, n_gif_imgs)
|
34 |
|
35 |
+
print("imagename", image_name.filename)
|
36 |
+
|
37 |
+
return "yeehaw"
|
38 |
+
|
39 |
# cred_width = c_width
|
40 |
# n_top_segs = n_top
|
41 |
# n_gif_images = n_gif_imgs
|
42 |
image, model_and_data = get_image_data(image_name)
|
43 |
+
# print("model_and_data", model_and_data)
|
44 |
# Unpack datax
|
45 |
xtest = model_and_data["xtest"]
|
46 |
ytest = model_and_data["ytest"]
|
|
|
91 |
# gradio's image inputs look like this: <PIL.Image.Image image mode=RGB size=305x266 at 0x7F3D01C91FA0>
|
92 |
# need to learn how to handle image inputs, or deal with file inputs or just file path strings
|
93 |
inp = gr.inputs.Textbox(lines=1, placeholder="Select an example from below", default="", label="Input Image Path", optional=False)
|
94 |
+
out = 'text'
|
95 |
+
# out = [gr.outputs.HTML(label="Output GIF"), gr.outputs.Textbox(label="Prediction")]
|
96 |
|
97 |
iface = gr.Interface(
|
98 |
segmentation_generation,
|