Nischay103
commited on
Commit
•
738a12d
1
Parent(s):
51844ef
Update app.py
Browse files
app.py
CHANGED
@@ -91,8 +91,19 @@ if uploaded_file is not None:
|
|
91 |
st.write(f"Recognized Character Sequence: {output}")
|
92 |
|
93 |
st.write("## examples")
|
94 |
-
cols = st.columns(4)
|
|
|
|
|
|
|
|
|
|
|
95 |
for idx,(model_variant,captcha_path) in enumerate(example_captchas.items()):
|
96 |
-
|
97 |
-
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
st.write(f"Recognized Character Sequence: {output}")
|
92 |
|
93 |
st.write("## examples")
|
94 |
+
# cols = st.columns(4)
|
95 |
+
# for idx,(model_variant,captcha_path) in enumerate(example_captchas.items()):
|
96 |
+
# col = cols[idx % 4]
|
97 |
+
# col.image(captcha_path,caption=f'{captcha_path.split("/")[-1]}', width=100)
|
98 |
+
# col.write(f"Model Version: {model_variant}")
|
99 |
+
|
100 |
for idx,(model_variant,captcha_path) in enumerate(example_captchas.items()):
|
101 |
+
with cols[idx % 4]:
|
102 |
+
st.image(captcha_path, caption=f'{captcha_path.split("/")[-1]}', width=130)
|
103 |
+
if st.button(f"Recognize with {model_variant}", key=f"button_{idx}"):
|
104 |
+
input = transform_image(captcha_path)
|
105 |
+
model = models[model_variant]
|
106 |
+
with torch.no_grad():
|
107 |
+
model_prediction = model(input)
|
108 |
+
output = get_label(model_prediction, model_variant)
|
109 |
+
st.write(f"Model {model_variant} recognized: {output}")
|