File size: 780 Bytes
cfc7f91
982c89f
 
cfc7f91
982c89f
cfc7f91
982c89f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
906cc8b
982c89f
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import gradio as gr
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("visual-question-answering", model="openbmb/MiniCPM-Llama3-V-2_5", trust_remote_code=True)

image = gr.image(type="pil", label="Image")
question = "Using the standar 9x9 sudoku format, solve the the sudoku puzzle in the image correctly."

answer = gr.outputs.Textbox(label="Answer", show_label=True, show_copy_button=True)


title = "Sudoku Solver by FG"
description = "Sudoku Solver using MiniCPM-Llama3-V-2_5"


def solve_sudoku(image, question):
    return pipe(image, question)

demo = gr.Interface(
    fn=solve_sudoku,
    inputs=[image, question],
    outputs=answer,
    title=title,
    description=description,
    theme="compact",
) 

demo.launch(share=True)