Skip to content

Commit 5e3ef4f

Browse files
committed
Removed file path lowercase conversion and adjusted help text.
1 parent 1b92175 commit 5e3ef4f

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

pix2tex.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def call_model(args, model, image_resizer, tokenizer):
8585
else:
8686
img = np.array(pad(img).convert('RGB'))
8787
t = test_transform(image=img)['image'][:1].unsqueeze(0)
88-
88+
print("processing... \n")
8989
im = t.to(args.device)
9090

9191
with torch.no_grad():
@@ -134,7 +134,8 @@ def call_model(args, model, image_resizer, tokenizer):
134134
args, *objs = initialize(args)
135135
while True:
136136
instructions = input('Predict LaTeX code for image ("?"/"h" for help). ')
137-
ins = instructions.strip().lower()
137+
possible_file = instructions.strip()
138+
ins = possible_file.lower()
138139
if ins == 'x':
139140
break
140141
elif ins in ['?', 'h', 'help']:
@@ -144,16 +145,16 @@ def call_model(args, model, image_resizer, tokenizer):
144145
On Windows and macOS you can copy the image into memory and just press ENTER to get a prediction.
145146
Alternatively you can paste the image file path here and submit.
146147
147-
You might get a different prediction every time you submit the same image. If the result you got was close you \
148-
can just predict the same image by pressing ENTER again. If that still does not work you can change the temperature \
149-
or you have take another picture with another resolution.
148+
You might get a different prediction every time you submit the same image. If the result you got was close you
149+
can just predict the same image by pressing ENTER again. If that still does not work you can change the temperature
150+
or you have to take another picture with another resolution (e.g. zoom out and take a screenshot with lower resolution).
150151
151152
Press "x" to close the program.
152153
You can interrupt the model if it takes too long by pressing Ctrl+C.
153154
154155
Visualization:
155-
You can either render the code into a png using XeLaTeX (see README) to get an image file back. \
156-
This is slow and requires a working installation of XeLaTeX. To activate type 'show' or set the flag --show
156+
You can either render the code into a png using XeLaTeX (see README) to get an image file back.
157+
This is slow and requires a working installation of XeLaTeX. To activate type 'show' or set the flag --show
157158
Alternatively you can render the expression in the browser using katex.org. Type 'katex' or set --katex
158159
159160
Settings:
@@ -165,8 +166,8 @@ def call_model(args, model, image_resizer, tokenizer):
165166
setattr(args, ins, not getattr(args, ins, False))
166167
print('set %s to %s' % (ins, getattr(args, ins)))
167168
continue
168-
elif os.path.isfile(ins):
169-
args.file = ins
169+
elif os.path.isfile(possible_file):
170+
args.file = possible_file
170171
else:
171172
t = re.match(r't=([\.\d]+)', ins)
172173
if t is not None:

0 commit comments

Comments
 (0)