Faustrix commited on
Commit
0429320
·
1 Parent(s): a8f34eb

chore: Update app.py with improved Gradio interface for Sudoku Solver

Browse files
Files changed (1) hide show
  1. app.py +11 -2
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
- result = pipe(image, question)
23
- return result[0]['answer']
 
 
 
 
 
 
 
 
 
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(