carlosabadia commited on
Commit
9c4964a
·
1 Parent(s): ea5c51c
__pycache__/model.cpython-310.pyc ADDED
Binary file (2.1 kB). View file
 
__pycache__/solver.cpython-310.pyc ADDED
Binary file (5.95 kB). View file
 
examples/A.3.png DELETED
Binary file (635 Bytes)
 
examples/A.4.png DELETED
Binary file (628 Bytes)
 
examples/A.6.png DELETED
Binary file (628 Bytes)
 
examples/Captura de pantalla de 2022-10-09 15-30-40.png ADDED
examples/Captura de pantalla de 2022-10-09 16-07-00.png ADDED
examples/Captura de pantalla de 2022-10-09 16-07-05.png ADDED
examples/descarga.png ADDED
examples/sopacompleta1.png ADDED
fonts/Roboto-Black.ttf ADDED
Binary file (168 kB). View file
 
model/2model28.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ec76d2434f8cb24f08df038ecb93ca91b15db9110df2ba340488c24c123b64b
3
+ size 14480208
model/model15.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eec6639695c7c0316156a5cfb3d783beee0a38bbacde8ad0695a197a5e99f48c
3
+ size 1716816
model/model2.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1277b3b473daad20ae22c3f70cf3fd5daf1d1fc2243df8b1abef95c14e230e9a
3
+ size 1716816
model/model30.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:939a3d5b2cb116c7a64430b3942ff806a7b66a58aa8e0e1b6448903f964ceee8
3
+ size 1716816
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
  torch==1.12.1
2
  torchvision==0.13.1
3
  gradio==3.1.4
4
- tensorflow==2.5.0
 
1
  torch==1.12.1
2
  torchvision==0.13.1
3
  gradio==3.1.4
4
+ tensorflow==2.5.0
src/__pycache__/solve.cpython-310.pyc ADDED
Binary file (2.93 kB). View file
 
src/__pycache__/solve.cpython-39.pyc ADDED
Binary file (2.96 kB). View file
 
src/__pycache__/tesseract.cpython-310.pyc ADDED
Binary file (763 Bytes). View file
 
src/__pycache__/tesseract.cpython-39.pyc ADDED
Binary file (940 Bytes). View file
 
src/solve.py ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Functions used to find the word in order of use
2
+ xy_positionsvec2 = []
3
+
4
+
5
+ def find_word (wordsearch, word):
6
+ """Trys to find word in wordsearch and prints result"""
7
+ # Store first character positions in array
8
+ start_pos = []
9
+ first_char = word[0]
10
+ for i in range(0, len(wordsearch)):
11
+ for j in range(0, len(wordsearch[i])):
12
+ if (checktilde(wordsearch[i][j],first_char) or wordsearch[i][j] == '?'):
13
+ start_pos.append([i,j])
14
+ # Check all starting positions for word
15
+ for p in start_pos:
16
+ found,xy_positionsvec = check_start(wordsearch, word, p)
17
+ if found:
18
+ # Word foundf
19
+ return xy_positionsvec,True
20
+ # Word not found
21
+ print(word, ' No encontrada')
22
+ return xy_positionsvec,False
23
+
24
+ def check_start (wordsearch, word, start_pos):
25
+ """Checks if the word starts at the startPos. Returns True if word found"""
26
+ directions = [[-1,1], [0,1], [1,1], [-1,0], [1,0], [-1,-1], [0,-1], [1,-1]]
27
+ # Iterate through all directions and check each for the word
28
+ for d in directions:
29
+ found,xy_positionsvec = check_dir(wordsearch, word, start_pos, d)
30
+ if (found):
31
+ return True,xy_positionsvec
32
+ return False,xy_positionsvec
33
+
34
+ def check_dir (wordsearch, word, start_pos, dir):
35
+ """Checks if the word is in a direction dir from the start_pos position in the wordsearch. Returns True and prints result if word found"""
36
+ xy_positionsvec = []
37
+ found_chars = [word[0]] # Characters found in direction. Already found the first character
38
+ current_pos = start_pos # Position we are looking at
39
+ pos = [start_pos] # Positions we have looked at
40
+ while (chars_match(found_chars, word)):
41
+ if (len(found_chars) == len(word)):
42
+ # If found all characters and all characters found are correct, then word has been found
43
+ print('')
44
+ print(word, ' Encontrada en:')
45
+ print('')
46
+ # Draw wordsearch on command line. Display found characters and '-' everywhere else
47
+ index =1
48
+ for x in range(0, len(wordsearch)):
49
+ line = ""
50
+ for y in range(0, len(wordsearch[x])):
51
+ is_pos = False
52
+ for z in pos:
53
+ if (z[0] == x) and (z[1] == y):
54
+ is_pos = True
55
+ if (is_pos):
56
+ xy_positions = {}
57
+ xy_positions['x'] = x
58
+ xy_positions['y'] = y
59
+ xy_positionsvec.append(xy_positions)
60
+ if (wordsearch[x][y] == '?'):
61
+ if (dir[1]*dir[0] == -1):
62
+ line = line + " " + word[len(word)-index]
63
+ else:
64
+ line = line + " " + word[index-1]
65
+ else:
66
+ line = line + " " + wordsearch[x][y]
67
+ index = index + 1
68
+ else:
69
+ line = line + " -"
70
+
71
+ print(line)
72
+ print('')
73
+ return True, xy_positionsvec
74
+ # Have not found enough letters so look at the next one
75
+ current_pos = [current_pos[0] + dir[0], current_pos[1] + dir[1]]
76
+ pos.append(current_pos)
77
+ if (is_valid_index(wordsearch, current_pos[0], current_pos[1])):
78
+ found_chars.append(wordsearch[current_pos[0]][current_pos[1]])
79
+ else:
80
+ # Reached edge of wordsearch and not found word
81
+
82
+ return False, xy_positionsvec
83
+
84
+ return False, xy_positionsvec
85
+
86
+
87
+ def chars_match (found, word):
88
+ """Checks if the leters found are the start of the word we are looking for"""
89
+ index = 0
90
+ for i in found:
91
+ if ( (not checktilde(i,word[index])) and i != '?'):
92
+ return False
93
+ index += 1
94
+ return True
95
+
96
+ def is_valid_index (wordsearch, line_num, col_num):
97
+ """Checks if the provided line number and column number are valid"""
98
+ if ((line_num >= 0) and (line_num < len(wordsearch))):
99
+ if ((col_num >= 0) and (col_num < len(wordsearch[line_num]))):
100
+ return True
101
+ return False
102
+
103
+ def checktilde (word1, word2):
104
+ if (word1 == word2):
105
+ return True
106
+ if ((word1 == 'A' or word1 == 'Á') and (word2 == 'A' or word2 == 'Á')):
107
+ return True
108
+ if ((word1 == 'E' or word1 == 'É') and (word2 == 'E' or word2 == 'É')):
109
+ return True
110
+ if ((word1 == 'I' or word1 == 'Í') and (word2 == 'I' or word2 == 'Í')):
111
+ return True
112
+ if ((word1 == 'O' or word1 == 'Ó') and (word2 == 'O' or word2 == 'Ó')):
113
+ return True
114
+ if ((word1 == 'U' or word1 == 'Ú') and (word2 == 'U' or word2 == 'Ú')):
115
+ return True
116
+ if ((word1 == 'Ñ' or word1 == 'N') and (word2 == 'N' or word2 == 'Ñ')):
117
+ return True
118
+ return False
words/descarga.png ADDED
words/words1.png ADDED