ginipick commited on
Commit
99be49b
ยท
verified ยท
1 Parent(s): 3b6333e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -32
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.Accordion("๊ณ ๊ธ‰ ์„ค์ •", open=False):
 
 
1154
 
 
1155
  system_message = gr.Textbox(
1156
- value="""You are a professional translator and journalist. Follow these steps strictly:
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
- label="System message"
1189
- )
1190
 
1191
-
1192
-
1193
  max_tokens = gr.Slider(
1194
  minimum=1,
1195
- maximum=7800,
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
+ )