Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,9 +4,13 @@ import json
|
|
4 |
import base64
|
5 |
|
6 |
# Mathpix์ ์ด๋ฏธ์ง ํ์ผ์ ๋ณด๋ด์ด LaTeX ๋ฌธ์์ด์ ์ถ์ถํ๋ ํจ์
|
7 |
-
def get_latex_from_image(
|
|
|
|
|
|
|
|
|
8 |
# ์ด๋ฏธ์ง ํ์ผ์ base64 ์ธ์ฝ๋ฉ
|
9 |
-
image_base64 = base64.b64encode(
|
10 |
|
11 |
# Mathpix API ์์ฒญ ํค๋
|
12 |
headers = {
|
|
|
4 |
import base64
|
5 |
|
6 |
# Mathpix์ ์ด๋ฏธ์ง ํ์ผ์ ๋ณด๋ด์ด LaTeX ๋ฌธ์์ด์ ์ถ์ถํ๋ ํจ์
|
7 |
+
def get_latex_from_image(image_path):
|
8 |
+
# ํ์ผ ๊ฒฝ๋ก์์ ์ด๋ฏธ์ง ํ์ผ์ ๋ฐ์ดํธ ํ์์ผ๋ก ์ฝ์
|
9 |
+
with open(image_path, "rb") as image_file:
|
10 |
+
image_bytes = image_file.read()
|
11 |
+
|
12 |
# ์ด๋ฏธ์ง ํ์ผ์ base64 ์ธ์ฝ๋ฉ
|
13 |
+
image_base64 = base64.b64encode(image_bytes).decode('utf-8')
|
14 |
|
15 |
# Mathpix API ์์ฒญ ํค๋
|
16 |
headers = {
|