rubend18 commited on
Commit
6254efb
·
1 Parent(s): f7b9d4d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -14
app.py CHANGED
@@ -1,18 +1,11 @@
1
  def print_board(tablero):
2
  output = ""
3
  for i in range(len(tablero)):
4
- #if i % 3 == 0 and i != 0:
5
- # output += "------+-------+------\n"
6
-
7
  for j in range(len(tablero[0])):
8
- #if j % 3 == 0 and j != 0:
9
- # output += "| "
10
-
11
  if j == 8:
12
  output += str(tablero[i][j]) + "\n"
13
  else:
14
  output += str(tablero[i][j]) + " "
15
-
16
  return output
17
 
18
  def resolver(tablero):
@@ -44,7 +37,7 @@ def es_valido(tablero, num, pos):
44
  if tablero[i][pos[1]] == num and pos[0] != i:
45
  return False
46
 
47
- # Comprobar caja
48
  caja_x = pos[1] // 3
49
  caja_y = pos[0] // 3
50
 
@@ -64,11 +57,7 @@ def buscar_vacio(tablero):
64
  return None
65
 
66
 
67
-
68
-
69
- # ********************************************************************************
70
- # INTERFAZ
71
- # ********************************************************************************
72
 
73
  import gradio as gr
74
 
@@ -121,7 +110,7 @@ examples=[["40003000000060080000000000100005009008000060007020000000010270050300
121
  demo = gr.Interface(
122
  fn=function,
123
  inputs=gr.Textbox(lines=2, label="Sudoku", placeholder="Ingrese la cadena del sudoku"),
124
- outputs=gr.Textbox(lines=10, label="Resultado", placeholder="Resultado..."),
125
  title="Resolver sudoku",
126
  examples=examples
127
  )
 
1
  def print_board(tablero):
2
  output = ""
3
  for i in range(len(tablero)):
 
 
 
4
  for j in range(len(tablero[0])):
 
 
 
5
  if j == 8:
6
  output += str(tablero[i][j]) + "\n"
7
  else:
8
  output += str(tablero[i][j]) + " "
 
9
  return output
10
 
11
  def resolver(tablero):
 
37
  if tablero[i][pos[1]] == num and pos[0] != i:
38
  return False
39
 
40
+ # Comprobar cuadrado
41
  caja_x = pos[1] // 3
42
  caja_y = pos[0] // 3
43
 
 
57
  return None
58
 
59
 
60
+ # Interfaz
 
 
 
 
61
 
62
  import gradio as gr
63
 
 
110
  demo = gr.Interface(
111
  fn=function,
112
  inputs=gr.Textbox(lines=2, label="Sudoku", placeholder="Ingrese la cadena del sudoku"),
113
+ outputs=gr.Textbox(lines=10, label="Solución", placeholder="Solución..."),
114
  title="Resolver sudoku",
115
  examples=examples
116
  )