Command commited on
Commit
195f7e6
·
1 Parent(s): eaf9ae6
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -2,6 +2,7 @@ import requests
2
  from PIL import Image
3
  from pix2tex.cli import LatexOCR
4
  from PIL import Image
 
5
  import streamlit
6
 
7
  model = LatexOCR()
@@ -27,9 +28,9 @@ else:
27
  if streamlit.button("Convert"):
28
  if uploaded_file is not None and image is not None:
29
  with streamlit.spinner("Computing"):
30
- image = Image.open(uploaded_file.getvalue())
31
  try:
32
- result = model(image)
33
  streamlit.code(result, language="latex")
34
  streamlit.markdown(f"$\\displaystyle {result}$")
35
  except Exception as e:
 
2
  from PIL import Image
3
  from pix2tex.cli import LatexOCR
4
  from PIL import Image
5
+ from io import BytesIO
6
  import streamlit
7
 
8
  model = LatexOCR()
 
28
  if streamlit.button("Convert"):
29
  if uploaded_file is not None and image is not None:
30
  with streamlit.spinner("Computing"):
31
+ image = Image.open(BytesIO(uploaded_file.getvalue()))
32
  try:
33
+ result = model(image, resize=False)
34
  streamlit.code(result, language="latex")
35
  streamlit.markdown(f"$\\displaystyle {result}$")
36
  except Exception as e: