Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -39,7 +39,12 @@ def translate_text_with_solar(english_text):
|
|
39 |
)
|
40 |
print("== ์ฑํ
ํจ์ ํธ์ถ๋จ ==")
|
41 |
|
42 |
-
prompt = "
|
|
|
|
|
|
|
|
|
|
|
43 |
response = client.chat.completions.create(
|
44 |
model="solar-pro",
|
45 |
messages=[{"role": "user", "content": prompt}],
|
@@ -57,13 +62,12 @@ with gr.Blocks(title="๐ ์๊ธ์จ ํธ์ง ๋ฒ์ญ๊ธฐ") as demo:
|
|
57 |
# ์ผ์ชฝ: ์ด๋ฏธ์ง ์
๋ก๋
|
58 |
with gr.Column(scale=1):
|
59 |
image_input = gr.Image(type="pil", label=" ๐ ํธ์ง ์ด๋ฏธ์ง ์
๋ก๋")
|
60 |
-
|
61 |
-
|
62 |
# ์ค๋ฅธ์ชฝ: ํ
์คํธ ๊ฒฐ๊ณผ
|
63 |
with gr.Column(scale=2):
|
64 |
-
english_box = gr.Textbox(label="๐ ์ถ์ถ๋ ์์ด ํ
์คํธ", lines=
|
65 |
translate_button = gr.Button("๐ ๋ฒ์ญํ๊ธฐ")
|
66 |
-
korean_box = gr.Textbox(label="๐ฐ๐ท ๋ฒ์ญ๋ ํ๊ตญ์ด ํ
์คํธ", lines=
|
67 |
|
68 |
# Step 1: ์ด๋ฏธ์ง ์
๋ก๋ ์ OCR ์คํ
|
69 |
image_input.change(fn=extract_text_from_image, inputs=image_input, outputs=english_box)
|
|
|
39 |
)
|
40 |
print("== ์ฑํ
ํจ์ ํธ์ถ๋จ ==")
|
41 |
|
42 |
+
prompt = f"""
|
43 |
+
๋ค์์ ์์ด ์๊ธ์จ ํธ์ง ๋ด์ฉ์
๋๋ค.\n
|
44 |
+
{english_text} \n
|
45 |
+
์์ด๋ฅผ ํ๊ตญ์ด๋ก ๋ฒ์ญํด์ฃผ์ธ์.\n\n
|
46 |
+
ํ๊ตญ์ด๋ก ๋ณ์ญ๋ ํธ์ง ๋ด์ฉ: "
|
47 |
+
"""
|
48 |
response = client.chat.completions.create(
|
49 |
model="solar-pro",
|
50 |
messages=[{"role": "user", "content": prompt}],
|
|
|
62 |
# ์ผ์ชฝ: ์ด๋ฏธ์ง ์
๋ก๋
|
63 |
with gr.Column(scale=1):
|
64 |
image_input = gr.Image(type="pil", label=" ๐ ํธ์ง ์ด๋ฏธ์ง ์
๋ก๋")
|
65 |
+
|
|
|
66 |
# ์ค๋ฅธ์ชฝ: ํ
์คํธ ๊ฒฐ๊ณผ
|
67 |
with gr.Column(scale=2):
|
68 |
+
english_box = gr.Textbox(label="๐ ์ถ์ถ๋ ์์ด ํ
์คํธ", lines=20)
|
69 |
translate_button = gr.Button("๐ ๋ฒ์ญํ๊ธฐ")
|
70 |
+
korean_box = gr.Textbox(label="๐ฐ๐ท ๋ฒ์ญ๋ ํ๊ตญ์ด ํ
์คํธ", lines=20)
|
71 |
|
72 |
# Step 1: ์ด๋ฏธ์ง ์
๋ก๋ ์ OCR ์คํ
|
73 |
image_input.change(fn=extract_text_from_image, inputs=image_input, outputs=english_box)
|