Spaces:
Sleeping
Sleeping
chore: Update app.py with improved Gradio interface for Sudoku Solver
Browse files
app.py
CHANGED
@@ -19,8 +19,17 @@ description = "Sudoku Solver using MiniCPM-Llama3-V-2_5"
|
|
19 |
|
20 |
# Define the function for solving Sudoku
|
21 |
def solve_sudoku(image, question):
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
# Create the Gradio interface
|
26 |
demo = gr.Interface(
|
|
|
19 |
|
20 |
# Define the function for solving Sudoku
|
21 |
def solve_sudoku(image, question):
|
22 |
+
msgs = [{"role": "user", "content": question}]
|
23 |
+
res = model.chat(
|
24 |
+
image=image,
|
25 |
+
msgs=msgs,
|
26 |
+
tokenizer=tokenizer,
|
27 |
+
sampling=True,
|
28 |
+
temperature=0.7,
|
29 |
+
stream=True,
|
30 |
+
system_prompt="You are an expert in solving sudoku puzzles. Please solve the sudoku puzzle in the image correctly.",
|
31 |
+
)
|
32 |
+
return res
|
33 |
|
34 |
# Create the Gradio interface
|
35 |
demo = gr.Interface(
|