Charlie Li
commited on
Commit
·
65e5a1d
1
Parent(s):
988d509
pregenerate samples
Browse files
app.py
CHANGED
@@ -96,7 +96,7 @@ def demo(Dataset, Model):
|
|
96 |
query_modes = ["d+t", "r+d", "vanilla"]
|
97 |
plot_title = {"r+d": "Recognized: ", "d+t": "OCR Input: ", "vanilla": ""}
|
98 |
text_outputs = []
|
99 |
-
img_outputs = []
|
100 |
video_outputs = []
|
101 |
for name in picked_samples:
|
102 |
img_path = os.path.join(path, name)
|
@@ -118,15 +118,15 @@ def demo(Dataset, Model):
|
|
118 |
print("Cached video at:", video_filepath)
|
119 |
video_outputs.append("./" + str(video_filepath))
|
120 |
|
121 |
-
fig, ax = plt.subplots()
|
122 |
-
ax.axis("off")
|
123 |
-
plot_ink(ink, ax, input_image=img)
|
124 |
-
buf = BytesIO()
|
125 |
-
fig.savefig(buf, format="png", bbox_inches="tight")
|
126 |
-
plt.close(fig)
|
127 |
-
buf.seek(0)
|
128 |
-
res = Image.open(buf)
|
129 |
-
img_outputs.append(res)
|
130 |
return (
|
131 |
img,
|
132 |
text_outputs[0],
|
|
|
96 |
query_modes = ["d+t", "r+d", "vanilla"]
|
97 |
plot_title = {"r+d": "Recognized: ", "d+t": "OCR Input: ", "vanilla": ""}
|
98 |
text_outputs = []
|
99 |
+
# img_outputs = []
|
100 |
video_outputs = []
|
101 |
for name in picked_samples:
|
102 |
img_path = os.path.join(path, name)
|
|
|
118 |
print("Cached video at:", video_filepath)
|
119 |
video_outputs.append("./" + str(video_filepath))
|
120 |
|
121 |
+
# fig, ax = plt.subplots()
|
122 |
+
# ax.axis("off")
|
123 |
+
# plot_ink(ink, ax, input_image=img)
|
124 |
+
# buf = BytesIO()
|
125 |
+
# fig.savefig(buf, format="png", bbox_inches="tight")
|
126 |
+
# plt.close(fig)
|
127 |
+
# buf.seek(0)
|
128 |
+
# res = Image.open(buf)
|
129 |
+
# img_outputs.append(res)
|
130 |
return (
|
131 |
img,
|
132 |
text_outputs[0],
|