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)