Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -877,26 +877,38 @@ def process_input(prompt: str, uploaded_files):
|
|
877 |
pairs.append((idea_title, idea_body))
|
878 |
|
879 |
# ๊ฐ ์์ด๋์ด๋ง๋ค ์ด๋ฏธ์ง ์์ฑ
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
table_match = re.search(
|
884 |
-
r"
|
|
|
|
|
885 |
)
|
886 |
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
900 |
|
901 |
|
902 |
# ๋ง์ฝ ๋ฌธ์ฅ ๋์ ๋ถํ์ํ ๊ตฌ๋์ ์ด๋ ์ค๋ฐ๊ฟ์ด ์์ ์ ์ ๊ฑฐ
|
|
|
877 |
pairs.append((idea_title, idea_body))
|
878 |
|
879 |
# ๊ฐ ์์ด๋์ด๋ง๋ค ์ด๋ฏธ์ง ์์ฑ
|
880 |
+
# ๊ฐ ์์ด๋์ด๋ง๋ค ์ด๋ฏธ์ง ์์ฑ (!!! ์ ์ฒด ๋ธ๋ก ๊ต์ฒด !!!)
|
881 |
+
for idx, (title, text_block) in enumerate(pairs, start=1):
|
882 |
+
# โ ํ(๋งํฌ๋ค์ด ํ
์ด๋ธ) ์์ ๋ค์ด์๋ ํํ โโ> | **Image Prompt** | prompt |
|
883 |
table_match = re.search(
|
884 |
+
r"\|\s*\*\*Image\s+Prompt\*\*\s*\|\s*([^\n|]+)",
|
885 |
+
text_block,
|
886 |
+
flags=re.IGNORECASE,
|
887 |
)
|
888 |
|
889 |
+
# โก ๋ฐฑ์
ํจํด: "Image Prompt: ..." ๋๋ "Image Prompt - ..."
|
890 |
+
if not table_match:
|
891 |
+
table_match = re.search(
|
892 |
+
r"(?i)Image\s+Prompt\s*[:|-]\s*([^\n]+)", text_block
|
893 |
+
)
|
894 |
+
|
895 |
+
if table_match:
|
896 |
+
raw_prompt = table_match.group(1).strip()
|
897 |
+
raw_prompt = re.sub(r"[\r\n\|`'\"\\]", " ", raw_prompt) # ๊ฐํยท๊ตฌ๋์ ์ ๋ฆฌ
|
898 |
+
|
899 |
+
# ์ด๋ฏธ์ง ์์ฑ
|
900 |
+
with st.spinner(f"Generating image for {title}..."):
|
901 |
+
img, cap = generate_image(raw_prompt)
|
902 |
+
if img:
|
903 |
+
st.image(img, caption=f"{title} โ {cap}")
|
904 |
+
st.session_state.messages.append(
|
905 |
+
{
|
906 |
+
"role": "assistant",
|
907 |
+
"content": "",
|
908 |
+
"image": img,
|
909 |
+
"image_caption": f"{title} โ {cap}",
|
910 |
+
}
|
911 |
+
)
|
912 |
|
913 |
|
914 |
# ๋ง์ฝ ๋ฌธ์ฅ ๋์ ๋ถํ์ํ ๊ตฌ๋์ ์ด๋ ์ค๋ฐ๊ฟ์ด ์์ ์ ์ ๊ฑฐ
|