Spaces:
Sleeping
Sleeping
Commit
·
f2274dc
1
Parent(s):
9e459c7
code
Browse files- __pycache__/solver.cpython-310.pyc +0 -0
- app.py +4 -4
- output/Tablero_solucion.png +0 -0
- solver.py +10 -4
- wordsPuzzle/ALDRIN.jpg +0 -0
- wordsPuzzle/BARNEY.jpg +0 -0
- wordsPuzzle/LAWYER.jpg +0 -0
- wordsPuzzle/LILY.jpg +0 -0
- wordsPuzzle/MANHATTAN.jpg +0 -0
- wordsPuzzle/MARSHALL.jpg +0 -0
- wordsPuzzle/MOSBY.jpg +0 -0
- wordsPuzzle/PRESENTER.jpg +0 -0
- wordsPuzzle/SCHERBATSKY.jpg +0 -0
- wordsPuzzle/TEACHER.jpg +0 -0
- wordsPuzzle/TED.jpg +0 -0
__pycache__/solver.cpython-310.pyc
CHANGED
Binary files a/__pycache__/solver.cpython-310.pyc and b/__pycache__/solver.cpython-310.pyc differ
|
|
app.py
CHANGED
@@ -49,7 +49,7 @@ def main():
|
|
49 |
|
50 |
with gr.Blocks(theme=args.theme, css='style.css') as demo:
|
51 |
gr.Markdown('''# World Puzzle Solver 🧩''')
|
52 |
-
gr.Markdown('''## (Works in Spanish too!)
|
53 |
|
54 |
with gr.Box():
|
55 |
gr.Markdown(
|
@@ -68,7 +68,7 @@ def main():
|
|
68 |
with gr.Row():
|
69 |
input_words = gr.Image(label='Words',
|
70 |
type='filepath',
|
71 |
-
interactive=True,
|
72 |
)
|
73 |
with gr.Row():
|
74 |
crop_words_button = gr.Button('Crop Words ✂️')
|
@@ -82,18 +82,18 @@ def main():
|
|
82 |
label='Image Examples (Drag and drop into both boxes) then crop using the tool button')
|
83 |
|
84 |
with gr.Box():
|
|
|
|
|
85 |
with gr.Column():
|
86 |
gr.Markdown('''Cropped Images ✂️''')
|
87 |
with gr.Row():
|
88 |
cropped_board = gr.Image(label='Board Cropped',
|
89 |
type='filepath',
|
90 |
interactive=False, height="auto")
|
91 |
-
instyle = gr.Variable()
|
92 |
with gr.Row():
|
93 |
cropped_words = gr.Image(label='Words Cropped',
|
94 |
type='filepath',
|
95 |
interactive=False)
|
96 |
-
instyle = gr.Variable()
|
97 |
with gr.Row():
|
98 |
find_words_button = gr.Button('Find Words 🔍')
|
99 |
with gr.Row():
|
|
|
49 |
|
50 |
with gr.Blocks(theme=args.theme, css='style.css') as demo:
|
51 |
gr.Markdown('''# World Puzzle Solver 🧩''')
|
52 |
+
gr.Markdown('''## (Works in Spanish too!) 🇪🇸''')
|
53 |
|
54 |
with gr.Box():
|
55 |
gr.Markdown(
|
|
|
68 |
with gr.Row():
|
69 |
input_words = gr.Image(label='Words',
|
70 |
type='filepath',
|
71 |
+
interactive=True,
|
72 |
)
|
73 |
with gr.Row():
|
74 |
crop_words_button = gr.Button('Crop Words ✂️')
|
|
|
82 |
label='Image Examples (Drag and drop into both boxes) then crop using the tool button')
|
83 |
|
84 |
with gr.Box():
|
85 |
+
# Change column height
|
86 |
+
|
87 |
with gr.Column():
|
88 |
gr.Markdown('''Cropped Images ✂️''')
|
89 |
with gr.Row():
|
90 |
cropped_board = gr.Image(label='Board Cropped',
|
91 |
type='filepath',
|
92 |
interactive=False, height="auto")
|
|
|
93 |
with gr.Row():
|
94 |
cropped_words = gr.Image(label='Words Cropped',
|
95 |
type='filepath',
|
96 |
interactive=False)
|
|
|
97 |
with gr.Row():
|
98 |
find_words_button = gr.Button('Find Words 🔍')
|
99 |
with gr.Row():
|
output/Tablero_solucion.png
DELETED
Binary file (713 kB)
|
|
solver.py
CHANGED
@@ -19,7 +19,7 @@ with open("class_names.txt", "r") as f: # reading them in from class_names.txt
|
|
19 |
|
20 |
model1 = tf.keras.models.load_model('model/model30.h5')
|
21 |
model2 = tf.keras.models.load_model('model/model15.h5')
|
22 |
-
|
23 |
|
24 |
palabras_1 = []
|
25 |
# Borrar el directorio de imagenes
|
@@ -177,12 +177,18 @@ def solve_puzzle(img, words):
|
|
177 |
img_array = img2.reshape(1, 28, 28, 1)
|
178 |
prediction1 = np.argmax(model1.predict(img_array))
|
179 |
prediction2 = np.argmax(model2.predict(img_array))
|
180 |
-
|
181 |
pred = 0
|
182 |
-
if prediction1 == prediction2:
|
183 |
pred = prediction1
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
else:
|
185 |
-
|
186 |
#print(characters[pred])
|
187 |
contCuadrados["anchura"] = x
|
188 |
contCuadrados["altura"] = y
|
|
|
19 |
|
20 |
model1 = tf.keras.models.load_model('model/model30.h5')
|
21 |
model2 = tf.keras.models.load_model('model/model15.h5')
|
22 |
+
model3 = tf.keras.models.load_model('model/model2.h5')
|
23 |
|
24 |
palabras_1 = []
|
25 |
# Borrar el directorio de imagenes
|
|
|
177 |
img_array = img2.reshape(1, 28, 28, 1)
|
178 |
prediction1 = np.argmax(model1.predict(img_array))
|
179 |
prediction2 = np.argmax(model2.predict(img_array))
|
180 |
+
prediction3 = np.argmax(model3.predict(img_array))
|
181 |
pred = 0
|
182 |
+
if prediction1 == prediction2 and prediction2 == prediction3:
|
183 |
pred = prediction1
|
184 |
+
elif prediction1 == prediction2:
|
185 |
+
pred = prediction1
|
186 |
+
elif prediction2 == prediction3:
|
187 |
+
pred = prediction2
|
188 |
+
elif prediction1 == prediction3:
|
189 |
+
pred = prediction3
|
190 |
else:
|
191 |
+
pred = 32
|
192 |
#print(characters[pred])
|
193 |
contCuadrados["anchura"] = x
|
194 |
contCuadrados["altura"] = y
|
wordsPuzzle/ALDRIN.jpg
DELETED
Binary file (202 kB)
|
|
wordsPuzzle/BARNEY.jpg
DELETED
Binary file (202 kB)
|
|
wordsPuzzle/LAWYER.jpg
DELETED
Binary file (203 kB)
|
|
wordsPuzzle/LILY.jpg
DELETED
Binary file (204 kB)
|
|
wordsPuzzle/MANHATTAN.jpg
DELETED
Binary file (210 kB)
|
|
wordsPuzzle/MARSHALL.jpg
DELETED
Binary file (201 kB)
|
|
wordsPuzzle/MOSBY.jpg
DELETED
Binary file (201 kB)
|
|
wordsPuzzle/PRESENTER.jpg
DELETED
Binary file (202 kB)
|
|
wordsPuzzle/SCHERBATSKY.jpg
DELETED
Binary file (202 kB)
|
|
wordsPuzzle/TEACHER.jpg
DELETED
Binary file (201 kB)
|
|
wordsPuzzle/TED.jpg
DELETED
Binary file (202 kB)
|
|