Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
WuShaoa authored Jan 4, 2024
1 parent 0431394 commit e40dd4e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions getlatex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import time
import pyperclip
from PIL import ImageGrab
from pix2tex.cli import LatexOCR
#pip3 install torch pyperclip pillow "pix2tex[gui]"
model = LatexOCR()
while True:
time.sleep(0.5)
img = ImageGrab.grabclipboard()
if img != None:
text = str(model(img))
# pyperclip.copy('\\begin{align}' + text + '\\end{align}')
pyperclip.copy(text)
print(text)

0 comments on commit e40dd4e

Please sign in to comment.