SodokuSolver / app.py
Faustrix's picture
Refactor app.py to use correct class names for image and answer variables
506dcd4
raw
history blame
772 Bytes
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.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)