Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,148 +1,53 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
import requests
|
| 3 |
-
import re
|
| 4 |
import os
|
| 5 |
import openai
|
| 6 |
|
| 7 |
-
def
|
| 8 |
-
print("[DEBUG]", *args)
|
| 9 |
-
|
| 10 |
-
########################################################
|
| 11 |
-
# (1) ๊ธฐ์กด ํจ์ (parse_track_number, fetch_script ๋ฑ)
|
| 12 |
-
########################################################
|
| 13 |
-
|
| 14 |
-
def parse_track_number(input_text):
|
| 15 |
-
debug_print("parse_track_number() called with input_text:", input_text)
|
| 16 |
-
match = re.search(r'<track[^>]*\skind="captions"[^>]*\ssrc="([^"]+)"', input_text)
|
| 17 |
-
if not match:
|
| 18 |
-
debug_print("ํธ๋ ํ๊ทธ(kinds='captions')์์ src ์ถ์ถ ์คํจ")
|
| 19 |
-
return None
|
| 20 |
-
|
| 21 |
-
track_number = match.group(1).strip()
|
| 22 |
-
debug_print("์ด๊ธฐ ์ถ์ถ๋ track_number:", track_number)
|
| 23 |
-
|
| 24 |
-
if 'blob:' in track_number:
|
| 25 |
-
track_number = track_number.replace('blob:', '')
|
| 26 |
-
debug_print("blob: ์ ๊ฑฐ ํ track_number:", track_number)
|
| 27 |
-
|
| 28 |
-
if 'https://player.vimeo.com' in track_number:
|
| 29 |
-
track_number = track_number.replace('https://player.vimeo.com', '')
|
| 30 |
-
debug_print("๋๋ฉ์ธ ์ ๊ฑฐ ํ track_number:", track_number)
|
| 31 |
-
|
| 32 |
-
track_number = track_number.strip()
|
| 33 |
-
if not track_number.startswith('/'):
|
| 34 |
-
track_number = '/' + track_number
|
| 35 |
-
debug_print("์์ / ์๋ ๊ฒฝ์ฐ ์ถ๊ฐ ํ track_number:", track_number)
|
| 36 |
-
|
| 37 |
-
debug_print("์ต์ข
track_number:", track_number)
|
| 38 |
-
return track_number
|
| 39 |
-
|
| 40 |
-
def fetch_script(url):
|
| 41 |
-
track_number = parse_track_number(url)
|
| 42 |
-
if not track_number:
|
| 43 |
-
return (
|
| 44 |
-
"ํธ๋๋ฒํธ๋ฅผ ์ฐพ์ง ๋ชปํ์ต๋๋ค.\n"
|
| 45 |
-
"์: <track kind='captions' src='/1234567' ...>"
|
| 46 |
-
)
|
| 47 |
-
|
| 48 |
-
target_url = f"https://player.vimeo.com{track_number}"
|
| 49 |
-
debug_print("์ ์ํ ํ๊ฒ URL:", target_url)
|
| 50 |
-
|
| 51 |
-
try:
|
| 52 |
-
response = requests.get(target_url)
|
| 53 |
-
if response.status_code == 200:
|
| 54 |
-
debug_print("์คํฌ๋ฆฝํธ ๊ฐ์ ธ์ค๊ธฐ ์ฑ๊ณต")
|
| 55 |
-
return response.text
|
| 56 |
-
else:
|
| 57 |
-
debug_print("HTTP ์๋ฌ ๋ฐ์:", response.status_code)
|
| 58 |
-
return f"HTTP ์๋ฌ: {response.status_code}"
|
| 59 |
-
except Exception as e:
|
| 60 |
-
debug_print("์์ธ ๋ฐ์:", str(e))
|
| 61 |
-
return f"์๋ฌ ๋ฐ์: {str(e)}"
|
| 62 |
-
|
| 63 |
-
def show_next_field(num_visible):
|
| 64 |
-
debug_print("show_next_field() called with num_visible:", num_visible)
|
| 65 |
-
if num_visible < 5:
|
| 66 |
-
num_visible += 1
|
| 67 |
-
debug_print("์๋ก์ด num_visible ๊ฐ:", num_visible)
|
| 68 |
-
|
| 69 |
-
updates = []
|
| 70 |
-
for i in range(1, 6):
|
| 71 |
-
updates.append(gr.update(visible=(i <= num_visible)))
|
| 72 |
-
|
| 73 |
-
return [num_visible] + updates
|
| 74 |
-
|
| 75 |
-
########################################################
|
| 76 |
-
# (2) (๊ธฐ์กด) ์ ์ฒด ์คํฌ๋ฆฝํธ ๋ก์ง
|
| 77 |
-
########################################################
|
| 78 |
-
|
| 79 |
-
def is_vtt_timeline_line(line: str) -> bool:
|
| 80 |
-
pattern = r'^\d{2}:\d{2}:\d{2}(\.\d+)?\s*-->\s*\d{2}:\d{2}:\d{2}(\.\d+)?$'
|
| 81 |
-
return bool(re.match(pattern, line.strip()))
|
| 82 |
-
|
| 83 |
-
def is_number_line(line: str) -> bool:
|
| 84 |
-
pattern = r'^\d+[\.\)]?$'
|
| 85 |
-
return bool(re.match(pattern, line.strip()))
|
| 86 |
-
|
| 87 |
-
def is_webvtt_header(line: str) -> bool:
|
| 88 |
-
return line.strip() == "WEBVTT"
|
| 89 |
-
|
| 90 |
-
def combine_scripts(script1, script2, script3, script4, script5):
|
| 91 |
-
scripts = [script1, script2, script3, script4, script5]
|
| 92 |
-
full_merged = []
|
| 93 |
-
filtered_merged = []
|
| 94 |
-
|
| 95 |
-
for idx, sc in enumerate(scripts, start=1):
|
| 96 |
-
if not sc or not sc.strip():
|
| 97 |
-
continue
|
| 98 |
-
|
| 99 |
-
lines = sc.splitlines()
|
| 100 |
-
# (A) ์ ์ฒด ์คํฌ๋ฆฝํธ
|
| 101 |
-
full_merged.append(f"[๊ฐ์{idx}]")
|
| 102 |
-
full_merged.extend(lines)
|
| 103 |
-
|
| 104 |
-
# (B) ์์ ์ฌํญ
|
| 105 |
-
filtered_merged.append(f"[๊ฐ์{idx}]")
|
| 106 |
-
for line in lines:
|
| 107 |
-
if is_vtt_timeline_line(line):
|
| 108 |
-
continue
|
| 109 |
-
if is_number_line(line):
|
| 110 |
-
continue
|
| 111 |
-
if is_webvtt_header(line):
|
| 112 |
-
continue
|
| 113 |
-
filtered_merged.append(line)
|
| 114 |
-
|
| 115 |
-
old_combined_script = "\n".join(full_merged)
|
| 116 |
-
old_changes_summary = "\n".join(filtered_merged)
|
| 117 |
-
return old_combined_script, old_changes_summary
|
| 118 |
-
|
| 119 |
-
########################################################
|
| 120 |
-
# (3) LLM์ ์ฌ์ฉํ ๋ฌธ์ฅ ๊ต์ : ํ ํ
์คํธ๋ก ํฉ์ณ์ ๋ฐํ
|
| 121 |
-
########################################################
|
| 122 |
-
|
| 123 |
-
def refine_with_llm(old_changes_summary_text):
|
| 124 |
"""
|
| 125 |
-
(๊ธฐ์กด) ์์ ์ฌํญ
|
| 126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
"""
|
| 128 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
|
| 130 |
system_prompt = (
|
| 131 |
-
"๋น์ ์ ํ๊ตญ์ด ๊ต์ ์ ๋ฌธ๊ฐ์
๋๋ค.
|
| 132 |
-
"
|
| 133 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
)
|
| 135 |
-
user_prompt = f"```\n{old_changes_summary_text}\n```\n์ ํ
์คํธ๋ฅผ ๊ต์ ํด ์ฃผ์ธ์"
|
| 136 |
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
|
| 143 |
try:
|
|
|
|
| 144 |
response = openai.ChatCompletion.create(
|
| 145 |
-
model="gpt-4o-mini", # ์ค์ ๋ชจ๋ธ ์กด์ฌ ์ฌ๋ถ ํ์ธ ํ์
|
| 146 |
messages=[
|
| 147 |
{"role": "system", "content": system_prompt},
|
| 148 |
{"role": "user", "content": user_prompt}
|
|
@@ -151,104 +56,18 @@ def refine_with_llm(old_changes_summary_text):
|
|
| 151 |
)
|
| 152 |
raw_output = response.choices[0].message["content"].strip()
|
| 153 |
except Exception as e:
|
| 154 |
-
return
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
corrected_sep = "=== ๊ต์ ๋ ๋ณธ๋ฌธ ==="
|
| 158 |
-
changes_sep = "=== ์์ ยท๊ต์ ์ฌํญ ==="
|
| 159 |
-
|
| 160 |
-
corrected_text = ""
|
| 161 |
-
changes_text = ""
|
| 162 |
-
|
| 163 |
-
if corrected_sep in raw_output and changes_sep in raw_output:
|
| 164 |
-
part1 = raw_output.split(corrected_sep, 1)[1]
|
| 165 |
-
if changes_sep in part1:
|
| 166 |
-
corrected_text, maybe_log = part1.split(changes_sep, 1)
|
| 167 |
-
corrected_text = corrected_text.strip()
|
| 168 |
-
changes_text = maybe_log.strip()
|
| 169 |
-
else:
|
| 170 |
-
corrected_text = part1.strip()
|
| 171 |
-
changes_text = "์์ ์ฌํญ ๊ตฌ๋ถ์ด ์์ต๋๋ค."
|
| 172 |
-
else:
|
| 173 |
-
corrected_text = raw_output
|
| 174 |
-
changes_text = "LLM ์๋ต์ ์์ ์ฌํญ ๊ตฌ๋ถ์ด ์์ต๋๋ค."
|
| 175 |
-
|
| 176 |
-
# **๊ฐ์๋ด์ฉ + ์์ ๊ต์ ์ฌํญ**์ ํ ํ
์คํธ๋ก ํฉ์ณ ๋ฐํ
|
| 177 |
-
final_output = f"{corrected_text}\n\n=== ์์ ยท๊ต์ ์ฌํญ ===\n{changes_text}"
|
| 178 |
-
return final_output
|
| 179 |
-
|
| 180 |
-
########################################################
|
| 181 |
-
# (4) build_app
|
| 182 |
-
########################################################
|
| 183 |
-
|
| 184 |
-
def build_app():
|
| 185 |
-
with gr.Blocks() as demo:
|
| 186 |
-
gr.Markdown("## ๊ฐ์ URL ์
๋ ฅ๊ธฐ")
|
| 187 |
-
|
| 188 |
-
num_visible = gr.State(value=2)
|
| 189 |
-
outputs = []
|
| 190 |
-
rows = []
|
| 191 |
-
|
| 192 |
-
for i in range(1, 6):
|
| 193 |
-
with gr.Row(visible=(i <= 2)) as row:
|
| 194 |
-
with gr.Column():
|
| 195 |
-
inp = gr.Textbox(
|
| 196 |
-
label=f"๊ฐ์{i} URL ์
๋ ฅ",
|
| 197 |
-
placeholder="ex) <track kind='captions' src='/1234567.vtt' ...>"
|
| 198 |
-
)
|
| 199 |
-
btn = gr.Button("์คํฌ๋ฆฝํธ ๊ฐ์ ธ์ค๊ธฐ")
|
| 200 |
-
out = gr.Textbox(
|
| 201 |
-
label=f"๊ฐ์{i} ์คํฌ๋ฆฝํธ",
|
| 202 |
-
lines=8
|
| 203 |
-
)
|
| 204 |
-
btn.click(fetch_script, inputs=inp, outputs=out)
|
| 205 |
-
|
| 206 |
-
rows.append(row)
|
| 207 |
-
outputs.append(out)
|
| 208 |
-
|
| 209 |
-
plus_btn = gr.Button("+")
|
| 210 |
-
plus_btn.click(show_next_field, inputs=num_visible, outputs=[num_visible]+rows)
|
| 211 |
-
|
| 212 |
-
# (๊ธฐ์กด) ์ ์ฒด ์คํฌ๋ฆฝํธ ๋ง๋ค๊ธฐ
|
| 213 |
-
with gr.Row():
|
| 214 |
-
old_combine_button = gr.Button("(๊ธฐ์กด) ์ ์ฒด ์คํฌ๋ฆฝํธ ๋ง๋ค๊ธฐ")
|
| 215 |
-
with gr.Row():
|
| 216 |
-
old_combined_box = gr.Textbox(
|
| 217 |
-
label="(๊ธฐ์กด) ์ ์ฒด ์คํฌ๋ฆฝํธ",
|
| 218 |
-
lines=10
|
| 219 |
-
)
|
| 220 |
-
old_changes_box = gr.Textbox(
|
| 221 |
-
label="(๊ธฐ์กด) ์์ ์ฌํญ",
|
| 222 |
-
lines=8
|
| 223 |
-
)
|
| 224 |
-
|
| 225 |
-
old_combine_button.click(
|
| 226 |
-
fn=combine_scripts,
|
| 227 |
-
inputs=outputs,
|
| 228 |
-
outputs=[old_combined_box, old_changes_box]
|
| 229 |
-
)
|
| 230 |
-
|
| 231 |
-
# (์ ๊ท) LLM (๊ต์ ๋ ๋ณธ๋ฌธ + ์์ ๊ต์ ์ฌํญ) -> ๋จ์ผ ํ
์คํธ๋ฐ์ค
|
| 232 |
-
with gr.Row():
|
| 233 |
-
llm_button = gr.Button("LLM(gpt-4o-mini)๋ก ๊ฐ์๋ด์ฉ ์ ๋ฆฌ")
|
| 234 |
-
|
| 235 |
-
with gr.Row():
|
| 236 |
-
final_output_box = gr.Textbox(
|
| 237 |
-
label="๊ฐ์๋ด์ฉ (์์ ยท๊ต์ ์ฌํญ ํฌํจ)",
|
| 238 |
-
lines=15,
|
| 239 |
-
placeholder="์ด๊ณณ์ ๊ต์ ๋ ๋ณธ๋ฌธ + ์์ ๊ต์ ์ฌํญ์ด ํจ๊ป ํ์๋ฉ๋๋ค."
|
| 240 |
-
)
|
| 241 |
-
|
| 242 |
-
# LLM ํธ์ถ -> ํ๋์ ํ
์คํธ๋ก ํฉ์ณ์ final_output_box์ ํ์
|
| 243 |
-
llm_button.click(
|
| 244 |
-
fn=refine_with_llm,
|
| 245 |
-
inputs=old_changes_box,
|
| 246 |
-
outputs=final_output_box
|
| 247 |
)
|
| 248 |
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import openai
|
| 3 |
|
| 4 |
+
def refine_with_llm_new(old_changes_summary_text: str):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
"""
|
| 6 |
+
1. (๊ธฐ์กด) ์์ ์ฌํญ ํ
์คํธ๋ฅผ ์
๋ ฅ๋ฐ์,
|
| 7 |
+
2. ์ค๋ฐ๊ฟ/๋์ด์ฐ๊ธฐ๋ฅผ ๋ฌธ๋งฅ์ ๋ง๊ฒ ์ฌ๊ตฌ์ฑ,
|
| 8 |
+
3. ๋ด์ฉ์ ์ ๋ ์์ฝ/์ญ์ /์์ ๋ณ๊ฒฝ ๊ธ์ง,
|
| 9 |
+
4. ์คํยท๋ง์ถค๋ฒ๋ง ์์ , ๊ทธ ์์ ๋ด์ญ์ ๋ณ๋๋ก ์ ๋ฆฌํด ์๋ ค์ค๋ค.
|
| 10 |
+
|
| 11 |
+
์ถ๋ ฅ:
|
| 12 |
+
(๊ต์ ๋ ๋ณธ๋ฌธ, ์์ ๋ด์ญ ์ ๋ฆฌ)
|
| 13 |
+
- ๊ต์ ๋ ๋ณธ๋ฌธ(๋ฌธ๋งฅ์ ๋ฌธ๋จ ๋๋๊ฑฐ๋ ๋ถ์ด๊ธฐ, ๋ง์ถค๋ฒ ์์ ๋ฐ์)
|
| 14 |
+
- ์์ ๋ด์ญ(์ด์ -> ์ดํ, ๋ชจ๋ ์์ ์ฌํญ)
|
| 15 |
"""
|
| 16 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|
| 17 |
+
if not openai.api_key:
|
| 18 |
+
return (
|
| 19 |
+
"์ค๋ฅ: OPENAI_API_KEY๊ฐ ์ค์ ๋์ง ์์์ต๋๋ค.",
|
| 20 |
+
"์์ ๋ด์ญ ์์"
|
| 21 |
+
)
|
| 22 |
|
| 23 |
system_prompt = (
|
| 24 |
+
"๋น์ ์ ํ๊ตญ์ด ๋ฌธ์ฅ ๊ต์ ์ ๋ฌธ๊ฐ์
๋๋ค.\n"
|
| 25 |
+
"์๋์ [๊ท์น]์ ์งํค๋ฉด์ ํ
์คํธ๋ฅผ ๊ต์ ํด ์ฃผ์ธ์.\n"
|
| 26 |
+
"[๊ท์น]\n"
|
| 27 |
+
"1) (๊ธฐ์กด) ์์ ์ฌํญ ํ
์คํธ๋ฅผ ์ฐ์ ๊ทธ๋๋ก ๊ธฐ์ต.\n"
|
| 28 |
+
"2) ์ค๋ฐ๊ฟ, ๋์ด์ฐ๊ธฐ๋ฅผ ๋ฌธ๋งฅ์ ๋ง๊ฒ ์ฌ๊ตฌ์ฑ.\n"
|
| 29 |
+
" - ๋ถ๋ฆฌ๋์ด์ผ ํ ๋ฌธ๋จ์ ๋ถ๋ฆฌํ๊ณ \n"
|
| 30 |
+
" - ๋ถ์ฌ์ผ ํ ๋ฌธ๋จ์ ๋ถ์ด๋\n"
|
| 31 |
+
" - ๋ด์ฉ์ ์ ๋ ์ญ์ ํ๊ฑฐ๋ ์์ฝํ์ง ๋ง ๊ฒ.\n"
|
| 32 |
+
"3) ์คํ๋ ๋ง์ถค๋ฒ์ด ์ ๋ง๋ ๊ฒ๋ง ์์ .\n"
|
| 33 |
+
" - ์์ ํ ๋ถ๋ถ์ ๋ชจ๋ ๋ณ๋๋ก ์ ๋ฆฌ.\n"
|
| 34 |
+
"4) ์ ๋ ์์๋ก ๋ด์ฉ์ ๋ฐ๊พธ์ง ์๋๋ค.\n"
|
| 35 |
)
|
|
|
|
| 36 |
|
| 37 |
+
user_prompt = (
|
| 38 |
+
f"์๋ ํ
์คํธ๋ฅผ [๊ท์น]์ ๋ฐ๋ผ ๊ต์ ํด ์ฃผ์ธ์.\n"
|
| 39 |
+
f"```\n{old_changes_summary_text}\n```"
|
| 40 |
+
"\n\n"
|
| 41 |
+
"์ถ๋ ฅ ํ์:\n"
|
| 42 |
+
"๊ต์ ๋ ๋ณธ๋ฌธ(๋ฌธ๋งฅ์ ๋ฌธ๋จ ์ฌ๊ตฌ์ฑ ๋ฐ์)\n"
|
| 43 |
+
"=== ์์ ๋ด์ญ ===\n"
|
| 44 |
+
"๋ชจ๋ ๊ต์ ์ฌํญ(์ด์ -> ์ดํ) ๋ฆฌ์คํธ\n"
|
| 45 |
+
)
|
| 46 |
|
| 47 |
try:
|
| 48 |
+
# (์: ์ต์ openai 1.0.0+ ์์๋ ChatCompletion ๋ฐฉ์์ ๊ณ์ ์ง์)
|
| 49 |
response = openai.ChatCompletion.create(
|
| 50 |
+
model="gpt-4o-mini", # ์ค์ ๋ชจ๋ธ ์กด์ฌ ์ฌ๋ถ๋ ๋ณ๋ ํ์ธ ํ์
|
| 51 |
messages=[
|
| 52 |
{"role": "system", "content": system_prompt},
|
| 53 |
{"role": "user", "content": user_prompt}
|
|
|
|
| 56 |
)
|
| 57 |
raw_output = response.choices[0].message["content"].strip()
|
| 58 |
except Exception as e:
|
| 59 |
+
return (
|
| 60 |
+
f"LLM ํธ์ถ ์ค๋ฅ: {str(e)}",
|
| 61 |
+
"์์ ๋ด์ญ ์ ๋ณด ์์ฑ ์คํจ"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
)
|
| 63 |
|
| 64 |
+
# ์๋๋ ๊ฐ์ ๋ ์ถ๋ ฅ ํ์:
|
| 65 |
+
# ๊ต์ ๋ ๋ณธ๋ฌธ
|
| 66 |
+
# === ์์ ๋ด์ญ ===
|
| 67 |
+
# (์์ ์ฌํญ๋ค)
|
| 68 |
+
if "=== ์์ ๋ด์ญ ===" in raw_output:
|
| 69 |
+
corrected_text, changes_text = raw_output.split("=== ์์ ๋ด์ญ ===", 1)
|
| 70 |
+
return corrected_text.strip(), changes_text.strip()
|
| 71 |
+
else:
|
| 72 |
+
# ์์ ๋ด์ญ ๊ตฌ๋ถ์ด ์์ผ๋ฉด, ํต์งธ๋ก ๋ณธ๋ฌธ์ผ๋ก ๋ฐํ
|
| 73 |
+
return raw_output, "์์ ๋ด์ญ ๊ตฌ๋ถ ์์"
|