Update app.py
Browse files
app.py
CHANGED
@@ -556,35 +556,25 @@ def generate_images(blog_post):
|
|
556 |
conclusion_index = next((i for i, line in enumerate(lines) if '[๊ฒฐ๋ก ]' in line), -1)
|
557 |
|
558 |
# 2. ๋์
๋ถ์ ๋ํ ์์ฝ์ผ๋ก ํฅ๋ฏธ ์ ๋ฐ ๋ชฉ์ ์ด๋ฏธ์ง ์์ฑ
|
559 |
-
if intro_index != -1 and body_index != -1
|
560 |
-
|
561 |
-
|
562 |
-
images.append(generate_image(intro_summary))
|
563 |
|
564 |
# 3. ๋ณธ๋ฌธ ๋ด์ฉ ์์ฝ์ผ๋ก ์ด๋ฏธ์ง ์์ฑ
|
565 |
-
if body_index != -1 and conclusion_index != -1
|
566 |
-
|
567 |
-
|
568 |
-
images.append(generate_image(body_summary))
|
569 |
|
570 |
# 4. ๊ฒฐ๋ก ๋ด์ฉ ์์ฝ์ผ๋ก ๋
์์๊ฒ ์ ๊ณต๋๋ ๊ฐ์น์ ์ด์ต์ ์ด๋ฏธ์ง๋ก ์์ฑ
|
571 |
-
if conclusion_index != -1
|
572 |
-
|
573 |
-
|
574 |
-
images.append(generate_image(value_summary))
|
575 |
|
576 |
# 5. ๊ฒฐ๋ก ๋ด์ฉ ์์ฝ์ผ๋ก ์์ง์ ์ด๋ฏธ์ง๋ก ์์ฑ
|
577 |
-
|
578 |
-
|
579 |
-
images.append(generate_image(symbolic_summary))
|
580 |
|
581 |
-
#
|
582 |
-
while len(images) < 5:
|
583 |
-
random_prompt = f"Supplementary image related to: {title}. Diverse, relevant, complementary visual"
|
584 |
-
images.append(generate_image(random_prompt))
|
585 |
-
|
586 |
-
return images[:5] # ์ต๋ 5๊ฐ์ ์ด๋ฏธ์ง๋ง ๋ฐํ
|
587 |
-
|
588 |
|
589 |
with gr.Blocks() as demo:
|
590 |
gr.Markdown(f"# {title}")
|
|
|
556 |
conclusion_index = next((i for i, line in enumerate(lines) if '[๊ฒฐ๋ก ]' in line), -1)
|
557 |
|
558 |
# 2. ๋์
๋ถ์ ๋ํ ์์ฝ์ผ๋ก ํฅ๋ฏธ ์ ๋ฐ ๋ชฉ์ ์ด๋ฏธ์ง ์์ฑ
|
559 |
+
intro_text = ' '.join(lines[intro_index+1:body_index]) if intro_index != -1 and body_index != -1 else title
|
560 |
+
intro_summary = f"Engaging and intriguing image to spark interest: {intro_text[:100]}... Eye-catching, thought-provoking, visually appealing"
|
561 |
+
images.append(generate_image(intro_summary))
|
|
|
562 |
|
563 |
# 3. ๋ณธ๋ฌธ ๋ด์ฉ ์์ฝ์ผ๋ก ์ด๋ฏธ์ง ์์ฑ
|
564 |
+
body_text = ' '.join(lines[body_index+1:conclusion_index]) if body_index != -1 and conclusion_index != -1 else title
|
565 |
+
body_summary = f"Detailed illustration of main content: {body_text[:100]}... Informative, clear visualization, key points highlighted"
|
566 |
+
images.append(generate_image(body_summary))
|
|
|
567 |
|
568 |
# 4. ๊ฒฐ๋ก ๋ด์ฉ ์์ฝ์ผ๋ก ๋
์์๊ฒ ์ ๊ณต๋๋ ๊ฐ์น์ ์ด์ต์ ์ด๋ฏธ์ง๋ก ์์ฑ
|
569 |
+
conclusion_text = ' '.join(lines[conclusion_index+1:]) if conclusion_index != -1 else title
|
570 |
+
value_summary = f"Image symbolizing the value and benefits for readers: {conclusion_text[:100]}... Positive outcomes, achievements, growth visualization"
|
571 |
+
images.append(generate_image(value_summary))
|
|
|
572 |
|
573 |
# 5. ๊ฒฐ๋ก ๋ด์ฉ ์์ฝ์ผ๋ก ์์ง์ ์ด๋ฏธ์ง๋ก ์์ฑ
|
574 |
+
symbolic_summary = f"Symbolic representation of the conclusion: {conclusion_text[:100]}... Abstract, metaphorical, thought-provoking imagery"
|
575 |
+
images.append(generate_image(symbolic_summary))
|
|
|
576 |
|
577 |
+
return images # ํญ์ 5๊ฐ์ ์ด๋ฏธ์ง๋ฅผ ๋ฐํ
|
|
|
|
|
|
|
|
|
|
|
|
|
578 |
|
579 |
with gr.Blocks() as demo:
|
580 |
gr.Markdown(f"# {title}")
|