Spaces:
Runtime error
Runtime error
Commit
Β·
3eda0b1
1
Parent(s):
74e761c
add files
Browse files
app.py
CHANGED
@@ -3,18 +3,19 @@ import gradio as gr
|
|
3 |
from PIL import Image
|
4 |
|
5 |
os.system("pip install pix2tex")
|
6 |
-
#os.system("pip install opencv-python-headless==4.1.2.30")
|
7 |
|
8 |
# Load model
|
9 |
from pix2tex import cli as pix2tex
|
|
|
10 |
model = pix2tex.LatexOCR()
|
11 |
|
12 |
|
13 |
def inference(input_image_path):
|
14 |
img = Image.open(input_image_path)
|
15 |
-
|
16 |
-
|
17 |
-
return
|
18 |
|
19 |
|
20 |
# Front end
|
@@ -29,7 +30,9 @@ demo = gr.Interface(
|
|
29 |
title=title,
|
30 |
description=description,
|
31 |
article=article,
|
32 |
-
inputs=gr.inputs.Image(
|
|
|
|
|
33 |
outputs=gr.outputs.Textbox(type="text", label="Output: Converted LaTeX code."),
|
34 |
examples=["./eqn1.png", "./eqn2.png", "./eqn3.png"],
|
35 |
)
|
|
|
3 |
from PIL import Image
|
4 |
|
5 |
os.system("pip install pix2tex")
|
6 |
+
# os.system("pip install opencv-python-headless==4.1.2.30")
|
7 |
|
8 |
# Load model
|
9 |
from pix2tex import cli as pix2tex
|
10 |
+
|
11 |
model = pix2tex.LatexOCR()
|
12 |
|
13 |
|
14 |
def inference(input_image_path):
|
15 |
img = Image.open(input_image_path)
|
16 |
+
output = model(img)
|
17 |
+
print("Model output:",output)
|
18 |
+
return output
|
19 |
|
20 |
|
21 |
# Front end
|
|
|
30 |
title=title,
|
31 |
description=description,
|
32 |
article=article,
|
33 |
+
inputs=gr.inputs.Image(
|
34 |
+
type="filepath", label="Input: Image of your equation you want to covert."
|
35 |
+
),
|
36 |
outputs=gr.outputs.Textbox(type="text", label="Output: Converted LaTeX code."),
|
37 |
examples=["./eqn1.png", "./eqn2.png", "./eqn3.png"],
|
38 |
)
|