Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -56,9 +56,14 @@ def text2story(text):
|
|
56 |
# Generate the story - limit to a smaller max_length due to model size
|
57 |
story = generator(prompt,
|
58 |
min_length=100,
|
|
|
59 |
num_return_sequences=1,
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
62 |
|
63 |
# Clean up the story by removing the prompt
|
64 |
story = story.replace(prompt, "").strip()
|
@@ -138,7 +143,7 @@ async def text2audio_english(text):
|
|
138 |
|
139 |
|
140 |
# Apply custom CSS for modern, stylish kid-friendly UI
|
141 |
-
st.set_page_config(page_title="
|
142 |
|
143 |
load_css('styles.css')
|
144 |
|
@@ -150,9 +155,9 @@ progress_placeholder = st.empty()
|
|
150 |
|
151 |
# File uploader with Cantonese
|
152 |
with st.container():
|
153 |
-
st.subheader("
|
154 |
uploaded_file = st.file_uploader(
|
155 |
-
"
|
156 |
type=["jpg", "jpeg", "png"], # Limit file types
|
157 |
key="upload"
|
158 |
)
|
@@ -160,7 +165,7 @@ with st.container():
|
|
160 |
if uploaded_file is not None:
|
161 |
st.success("上載成功!")
|
162 |
else:
|
163 |
-
st.info("
|
164 |
|
165 |
if uploaded_file is not None:
|
166 |
# Save uploaded file
|
@@ -176,7 +181,7 @@ if uploaded_file is not None:
|
|
176 |
if st.session_state.scenario is None:
|
177 |
# Stage 1: Image to Text
|
178 |
with st.container():
|
179 |
-
st.markdown("<h3><span class='stage-icon'>🔍</span>
|
180 |
|
181 |
with progress_placeholder.container():
|
182 |
st.write("正在分析圖片...")
|
|
|
56 |
# Generate the story - limit to a smaller max_length due to model size
|
57 |
story = generator(prompt,
|
58 |
min_length=100,
|
59 |
+
max_length=800,
|
60 |
num_return_sequences=1,
|
61 |
+
top_k=50,
|
62 |
+
top_p=0.92,
|
63 |
+
no_repeat_ngram_size=3,
|
64 |
+
temperature=0.8,
|
65 |
+
repetition_penalty=1.3,
|
66 |
+
do_sample=True)[0]['generated_text']
|
67 |
|
68 |
# Clean up the story by removing the prompt
|
69 |
story = story.replace(prompt, "").strip()
|
|
|
143 |
|
144 |
|
145 |
# Apply custom CSS for modern, stylish kid-friendly UI
|
146 |
+
st.set_page_config(page_title="歡迎嚟到 ISOM 5240 - 故事魔法師!", page_icon="✨", layout="wide")
|
147 |
|
148 |
load_css('styles.css')
|
149 |
|
|
|
155 |
|
156 |
# File uploader with Cantonese
|
157 |
with st.container():
|
158 |
+
st.subheader("請選擇一張畫作上載,格式必須係 JPG、JPEG 或 PNG! 最大 200 MB !")
|
159 |
uploaded_file = st.file_uploader(
|
160 |
+
"",
|
161 |
type=["jpg", "jpeg", "png"], # Limit file types
|
162 |
key="upload"
|
163 |
)
|
|
|
165 |
if uploaded_file is not None:
|
166 |
st.success("上載成功!")
|
167 |
else:
|
168 |
+
st.info("請選擇一張畫作上載,格式必須係 JPG、JPEG 或 PNG! 最大 200 MB !")
|
169 |
|
170 |
if uploaded_file is not None:
|
171 |
# Save uploaded file
|
|
|
181 |
if st.session_state.scenario is None:
|
182 |
# Stage 1: Image to Text
|
183 |
with st.container():
|
184 |
+
st.markdown("<h3><span class='stage-icon'>🔍</span> 畫作解讀中</h3>", unsafe_allow_html=True)
|
185 |
|
186 |
with progress_placeholder.container():
|
187 |
st.write("正在分析圖片...")
|