Update app.py
Browse files
app.py
CHANGED
|
@@ -11,13 +11,13 @@ args = Munch({'config': 'settings/config.yaml',
|
|
| 11 |
model = LatexOCR(args)
|
| 12 |
|
| 13 |
if __name__ == '__main__':
|
| 14 |
-
streamlit.set_page_config(page_title='LaTeX-
|
| 15 |
-
streamlit.title('LaTeX
|
| 16 |
streamlit.markdown(
|
| 17 |
-
'
|
| 18 |
|
| 19 |
uploaded_file = streamlit.file_uploader(
|
| 20 |
-
'
|
| 21 |
type=['png', 'jpg'],
|
| 22 |
)
|
| 23 |
|
|
@@ -27,9 +27,9 @@ if __name__ == '__main__':
|
|
| 27 |
else:
|
| 28 |
streamlit.text('\n')
|
| 29 |
|
| 30 |
-
if streamlit.button('
|
| 31 |
if uploaded_file is not None and image is not None:
|
| 32 |
-
with streamlit.spinner('
|
| 33 |
try:
|
| 34 |
latex_code = model(image)
|
| 35 |
streamlit.code(latex_code, language='latex')
|
|
@@ -37,4 +37,4 @@ if __name__ == '__main__':
|
|
| 37 |
except Exception as e:
|
| 38 |
streamlit.error(e)
|
| 39 |
else:
|
| 40 |
-
streamlit.error('
|
|
|
|
| 11 |
model = LatexOCR(args)
|
| 12 |
|
| 13 |
if __name__ == '__main__':
|
| 14 |
+
streamlit.set_page_config(page_title='LaTeX-OCR_CN')
|
| 15 |
+
streamlit.title('LaTeX OCR_CN')
|
| 16 |
streamlit.markdown(
|
| 17 |
+
'将方程式或者数学公式的图像转换为相应的 LaTeX 代码,.\n\n这是基于pix2tex项目.查看[](https://github.com/lukas-blecher/LaTeX-OCR)')
|
| 18 |
|
| 19 |
uploaded_file = streamlit.file_uploader(
|
| 20 |
+
'上传公式图片',
|
| 21 |
type=['png', 'jpg'],
|
| 22 |
)
|
| 23 |
|
|
|
|
| 27 |
else:
|
| 28 |
streamlit.text('\n')
|
| 29 |
|
| 30 |
+
if streamlit.button('转换'):
|
| 31 |
if uploaded_file is not None and image is not None:
|
| 32 |
+
with streamlit.spinner('计算中'):
|
| 33 |
try:
|
| 34 |
latex_code = model(image)
|
| 35 |
streamlit.code(latex_code, language='latex')
|
|
|
|
| 37 |
except Exception as e:
|
| 38 |
streamlit.error(e)
|
| 39 |
else:
|
| 40 |
+
streamlit.error('请上传图片.')
|