Faustrix commited on
Commit
982c89f
·
1 Parent(s): cfc7f91

chore: Add Sudoku Solver interface using MiniCPM-Llama3-V-2_5 model

Browse files
Files changed (1) hide show
  1. app.py +26 -4
app.py CHANGED
@@ -1,7 +1,29 @@
1
  import gradio as gr
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ # Use a pipeline as a high-level helper
3
+ from transformers import pipeline
4
 
5
+ pipe = pipeline("visual-question-answering", model="openbmb/MiniCPM-Llama3-V-2_5", trust_remote_code=True)
 
6
 
7
+ image = gr.image(type="pil", label="Image")
8
+ question = "Using the standar 9x9 sudoku format, solve the the sudoku puzzle in the image correctly."
9
+
10
+ answer = gr.outputs.Textbox(label="Answer", show_label=True, show_copy_button=True)
11
+
12
+
13
+ title = "Sudoku Solver by FG"
14
+ description = "Sudoku Solver using MiniCPM-Llama3-V-2_5"
15
+
16
+
17
+ def solve_sudoku(image, question):
18
+ return pipe(image, question)
19
+
20
+ demo = gr.Interface(
21
+ fn=solve_sudoku,
22
+ inputs=[image, question],
23
+ outputs=answer,
24
+ title=title,
25
+ description=description
26
+ theme="compact",
27
+ )
28
+
29
+ demo.launch(share=True)