seawolf2357 commited on
Commit
4fa0559
ยท
verified ยท
1 Parent(s): 0350c55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -4,9 +4,13 @@ import json
4
  import base64
5
 
6
  # Mathpix์— ์ด๋ฏธ์ง€ ํŒŒ์ผ์„ ๋ณด๋‚ด์–ด LaTeX ๋ฌธ์ž์—ด์„ ์ถ”์ถœํ•˜๋Š” ํ•จ์ˆ˜
7
- def get_latex_from_image(image):
 
 
 
 
8
  # ์ด๋ฏธ์ง€ ํŒŒ์ผ์„ base64 ์ธ์ฝ”๋”ฉ
9
- image_base64 = base64.b64encode(image).decode('utf-8')
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 = {