Spaces:
Sleeping
Sleeping
chore: Add Sudoku Solver interface using MiniCPM-Llama3-V-2_5 model
Browse files
app.py
CHANGED
|
@@ -1,7 +1,29 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
return "Hello " + name + "!!"
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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)
|