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