Spaces:
Build error
Build error
Nguyen Thai Thao Uyen
commited on
Commit
·
9e43181
1
Parent(s):
fbc5057
Add Plot
Browse files
app.py
CHANGED
@@ -43,18 +43,18 @@ def server(input: Inputs, output: Outputs, session: Session):
|
|
43 |
return None
|
44 |
|
45 |
@output
|
46 |
-
@render.image
|
47 |
-
def image_output():
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
@render.plot
|
58 |
def plot():
|
59 |
if input.image_input():
|
60 |
new_image = input.image_input()[0]['datapath']
|
@@ -78,7 +78,10 @@ def server(input: Inputs, output: Outputs, session: Session):
|
|
78 |
ax.set_yticks([])
|
79 |
ax.set_xticklabels([])
|
80 |
ax.set_yticklabels([])
|
81 |
-
|
|
|
|
|
|
|
82 |
return fig
|
83 |
|
84 |
|
|
|
43 |
return None
|
44 |
|
45 |
@output
|
46 |
+
# @render.image
|
47 |
+
# def image_output():
|
48 |
+
# here = Path(__file__).parent
|
49 |
+
# if input.image_input():
|
50 |
+
# src = input.image_input()[0]['datapath']
|
51 |
+
# img = {"src": src, "width": "500px"}
|
52 |
+
# x = run.pred(src)
|
53 |
+
# print(x)
|
54 |
+
# return img
|
55 |
+
# return None
|
56 |
+
|
57 |
+
@render.plot
|
58 |
def plot():
|
59 |
if input.image_input():
|
60 |
new_image = input.image_input()[0]['datapath']
|
|
|
78 |
ax.set_yticks([])
|
79 |
ax.set_xticklabels([])
|
80 |
ax.set_yticklabels([])
|
81 |
+
else:
|
82 |
+
fig, _ = plt.subplots() # Create an empty figure if no image received
|
83 |
+
fig.text(0.5, 0.5, "No image received", ha='center', va='center', fontsize=14)
|
84 |
+
print("no image received")
|
85 |
return fig
|
86 |
|
87 |
|