Spaces:
Building
Building
Update app.py
Browse files
app.py
CHANGED
@@ -1077,7 +1077,6 @@ with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css, title="NewsAI ์๋น
|
|
1077 |
translated_query_display = gr.Markdown(visible=False)
|
1078 |
search_button = gr.Button("๊ฒ์", variant="primary")
|
1079 |
|
1080 |
-
|
1081 |
progress = gr.Progress()
|
1082 |
articles_state = gr.State([])
|
1083 |
|
@@ -1135,8 +1134,7 @@ with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css, title="NewsAI ์๋น
|
|
1135 |
'index': i,
|
1136 |
})
|
1137 |
|
1138 |
-
|
1139 |
-
# AI ๋ฒ์ญ ํญ ์ถ๊ฐ
|
1140 |
with gr.Tab("AI ๊ธฐ์ฌ ์์ฑ"):
|
1141 |
gr.Markdown("๋ด์ค URL์ ์
๋ ฅํ๋ฉด AI๊ฐ ํ๊ตญ์ด๋ก ๋ฒ์ญํ์ฌ ๊ธฐ์ฌ ํ์์ผ๋ก ์์ฑํฉ๋๋ค.")
|
1142 |
gr.Markdown("์ด๋ฏธ์ง ์์ฑ: https://huggingface.co/spaces/ginipick/FLUXllama ")
|
@@ -1150,15 +1148,17 @@ with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css, title="NewsAI ์๋น
|
|
1150 |
placeholder="https://..."
|
1151 |
)
|
1152 |
|
1153 |
-
with gr.
|
|
|
|
|
1154 |
|
|
|
1155 |
system_message = gr.Textbox(
|
1156 |
-
|
1157 |
1. TRANSLATION
|
1158 |
- Start with ===๋ฒ์ญ=== marker
|
1159 |
- Provide accurate Korean translation
|
1160 |
- Maintain original meaning and context
|
1161 |
-
|
1162 |
2. ARTICLE WRITING
|
1163 |
- Start with ===๊ธฐ์ฌ=== marker
|
1164 |
- Write a new Korean news article based on the translation
|
@@ -1179,20 +1179,17 @@ with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css, title="NewsAI ์๋น
|
|
1179 |
- Format: "์ด๋ฏธ์ง ์ค๋ช
: [์์ธ ์ค๋ช
]"
|
1180 |
- Add style keywords: "์คํ์ผ: [๊ด๋ จ ํค์๋๋ค]"
|
1181 |
- Add mood keywords: "๋ถ์๊ธฐ: [๊ด๋ จ ํค์๋๋ค]"
|
1182 |
-
|
1183 |
IMPORTANT:
|
1184 |
- Must complete all three steps in order
|
1185 |
- Clearly separate each section with markers
|
1186 |
- Never skip or combine steps
|
1187 |
- Ensure image prompts align with article content""",
|
1188 |
-
|
1189 |
-
|
1190 |
|
1191 |
-
|
1192 |
-
|
1193 |
max_tokens = gr.Slider(
|
1194 |
minimum=1,
|
1195 |
-
|
1196 |
value=7624,
|
1197 |
step=1,
|
1198 |
label="Max new tokens"
|
@@ -1211,26 +1208,7 @@ with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css, title="NewsAI ์๋น
|
|
1211 |
step=0.05,
|
1212 |
label="Top-P"
|
1213 |
)
|
1214 |
-
|
1215 |
-
translate_button = gr.Button("๊ธฐ์ฌ ์์ฑ", variant="primary")
|
1216 |
-
|
1217 |
-
# ์ด๋ฒคํธ ์ฐ๊ฒฐ
|
1218 |
-
translate_button.click(
|
1219 |
-
fn=respond,
|
1220 |
-
inputs=[
|
1221 |
-
url_input,
|
1222 |
-
chatbot,
|
1223 |
-
system_message,
|
1224 |
-
max_tokens,
|
1225 |
-
temperature,
|
1226 |
-
top_p,
|
1227 |
-
],
|
1228 |
-
outputs=chatbot
|
1229 |
-
)
|
1230 |
-
|
1231 |
-
|
1232 |
|
1233 |
-
|
1234 |
# ์ด๋ฒคํธ ์ฐ๊ฒฐ ๋ถ๋ถ
|
1235 |
# ๊ตญ๊ฐ๋ณ ํญ ์ด๋ฒคํธ
|
1236 |
search_outputs = [status_message, translated_query_display, gr.Markdown(visible=False)]
|
@@ -1264,6 +1242,33 @@ with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css, title="NewsAI ์๋น
|
|
1264 |
show_progress=True
|
1265 |
)
|
1266 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1267 |
iface.launch(
|
1268 |
server_name="0.0.0.0",
|
1269 |
server_port=7860,
|
@@ -1271,4 +1276,4 @@ iface.launch(
|
|
1271 |
auth=("gini","pick"),
|
1272 |
ssl_verify=False,
|
1273 |
show_error=True
|
1274 |
-
)
|
|
|
1077 |
translated_query_display = gr.Markdown(visible=False)
|
1078 |
search_button = gr.Button("๊ฒ์", variant="primary")
|
1079 |
|
|
|
1080 |
progress = gr.Progress()
|
1081 |
articles_state = gr.State([])
|
1082 |
|
|
|
1134 |
'index': i,
|
1135 |
})
|
1136 |
|
1137 |
+
# AI ๋ฒ์ญ ํญ
|
|
|
1138 |
with gr.Tab("AI ๊ธฐ์ฌ ์์ฑ"):
|
1139 |
gr.Markdown("๋ด์ค URL์ ์
๋ ฅํ๋ฉด AI๊ฐ ํ๊ตญ์ด๋ก ๋ฒ์ญํ์ฌ ๊ธฐ์ฌ ํ์์ผ๋ก ์์ฑํฉ๋๋ค.")
|
1140 |
gr.Markdown("์ด๋ฏธ์ง ์์ฑ: https://huggingface.co/spaces/ginipick/FLUXllama ")
|
|
|
1148 |
placeholder="https://..."
|
1149 |
)
|
1150 |
|
1151 |
+
with gr.Row():
|
1152 |
+
translate_button = gr.Button("๊ธฐ์ฌ ์์ฑ", variant="primary")
|
1153 |
+
continue_button = gr.Button("๊ณ์ ์ด์ด์ ์์ฑ", variant="secondary")
|
1154 |
|
1155 |
+
with gr.Accordion("๊ณ ๊ธ ์ค์ ", open=False):
|
1156 |
system_message = gr.Textbox(
|
1157 |
+
value="""You are a professional translator and journalist. Follow these steps strictly:
|
1158 |
1. TRANSLATION
|
1159 |
- Start with ===๋ฒ์ญ=== marker
|
1160 |
- Provide accurate Korean translation
|
1161 |
- Maintain original meaning and context
|
|
|
1162 |
2. ARTICLE WRITING
|
1163 |
- Start with ===๊ธฐ์ฌ=== marker
|
1164 |
- Write a new Korean news article based on the translation
|
|
|
1179 |
- Format: "์ด๋ฏธ์ง ์ค๋ช
: [์์ธ ์ค๋ช
]"
|
1180 |
- Add style keywords: "์คํ์ผ: [๊ด๋ จ ํค์๋๋ค]"
|
1181 |
- Add mood keywords: "๋ถ์๊ธฐ: [๊ด๋ จ ํค์๋๋ค]"
|
|
|
1182 |
IMPORTANT:
|
1183 |
- Must complete all three steps in order
|
1184 |
- Clearly separate each section with markers
|
1185 |
- Never skip or combine steps
|
1186 |
- Ensure image prompts align with article content""",
|
1187 |
+
label="System message"
|
1188 |
+
)
|
1189 |
|
|
|
|
|
1190 |
max_tokens = gr.Slider(
|
1191 |
minimum=1,
|
1192 |
+
maximum=7800,
|
1193 |
value=7624,
|
1194 |
step=1,
|
1195 |
label="Max new tokens"
|
|
|
1208 |
step=0.05,
|
1209 |
label="Top-P"
|
1210 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1211 |
|
|
|
1212 |
# ์ด๋ฒคํธ ์ฐ๊ฒฐ ๋ถ๋ถ
|
1213 |
# ๊ตญ๊ฐ๋ณ ํญ ์ด๋ฒคํธ
|
1214 |
search_outputs = [status_message, translated_query_display, gr.Markdown(visible=False)]
|
|
|
1242 |
show_progress=True
|
1243 |
)
|
1244 |
|
1245 |
+
# AI ๋ฒ์ญ ํญ ์ด๋ฒคํธ
|
1246 |
+
translate_button.click(
|
1247 |
+
fn=respond,
|
1248 |
+
inputs=[
|
1249 |
+
url_input,
|
1250 |
+
chatbot,
|
1251 |
+
system_message,
|
1252 |
+
max_tokens,
|
1253 |
+
temperature,
|
1254 |
+
top_p,
|
1255 |
+
],
|
1256 |
+
outputs=chatbot
|
1257 |
+
)
|
1258 |
+
|
1259 |
+
# ๊ณ์ ์์ฑ ๋ฒํผ ์ด๋ฒคํธ
|
1260 |
+
continue_button.click(
|
1261 |
+
fn=continue_writing,
|
1262 |
+
inputs=[
|
1263 |
+
chatbot,
|
1264 |
+
system_message,
|
1265 |
+
max_tokens,
|
1266 |
+
temperature,
|
1267 |
+
top_p,
|
1268 |
+
],
|
1269 |
+
outputs=chatbot
|
1270 |
+
)
|
1271 |
+
|
1272 |
iface.launch(
|
1273 |
server_name="0.0.0.0",
|
1274 |
server_port=7860,
|
|
|
1276 |
auth=("gini","pick"),
|
1277 |
ssl_verify=False,
|
1278 |
show_error=True
|
1279 |
+
)
|