Sebastien
commited on
Commit
·
9c80fef
1
Parent(s):
432d1ad
improving demo text
Browse files
app.py
CHANGED
@@ -92,8 +92,9 @@ option = st.selectbox(
|
|
92 |
"select template grids",
|
93 |
grids,
|
94 |
)
|
95 |
-
x = st.text_area('grid', value=grids[option], height=300)
|
96 |
|
|
|
97 |
tensor_grid, df_styler = build_grid_and_display(str_to_row_col_grid(x))
|
98 |
# st.table(df_styler)
|
99 |
# st.dataframe(df_styler)
|
@@ -102,13 +103,15 @@ html = df_styler.to_html(escape=False, index=False)
|
|
102 |
st.html(html)
|
103 |
st.markdown('''
|
104 |
## Checking the number of solutions
|
105 |
-
(with backtracking algorithm)
|
106 |
-
|
|
|
107 |
''')
|
108 |
n_sol = get_grid_number_soluce(str_to_row_col_grid(x))
|
109 |
|
110 |
st.markdown(f"number of solution: {'>2' if n_sol==2 else n_sol}")
|
111 |
if n_sol==1:
|
|
|
112 |
new_X = model.predict(tensor_grid)
|
113 |
X_sum= new_X.sum()
|
114 |
st.html(display_as_dataframe(new_X).to_html(escape=False, index=False))
|
|
|
92 |
"select template grids",
|
93 |
grids,
|
94 |
)
|
95 |
+
x = st.text_area('You can edit the grid, every format is accepted. Empty cell can be designed by `0` or by `.`', value=grids[option], height=300)
|
96 |
|
97 |
+
st.markdown('### Initial grid')
|
98 |
tensor_grid, df_styler = build_grid_and_display(str_to_row_col_grid(x))
|
99 |
# st.table(df_styler)
|
100 |
# st.dataframe(df_styler)
|
|
|
103 |
st.html(html)
|
104 |
st.markdown('''
|
105 |
## Checking the number of solutions
|
106 |
+
(with classical backtracking algorithm).
|
107 |
+
|
108 |
+
Number of solutions must be one to trigger the grid resolution.
|
109 |
''')
|
110 |
n_sol = get_grid_number_soluce(str_to_row_col_grid(x))
|
111 |
|
112 |
st.markdown(f"number of solution: {'>2' if n_sol==2 else n_sol}")
|
113 |
if n_sol==1:
|
114 |
+
st.markdown('## Predicting grid step by step')
|
115 |
new_X = model.predict(tensor_grid)
|
116 |
X_sum= new_X.sum()
|
117 |
st.html(display_as_dataframe(new_X).to_html(escape=False, index=False))
|