MANIKANDAN A
commited on
Commit
·
5c5c6ed
1
Parent(s):
5247ff8
Update app.py
Browse files
app.py
CHANGED
@@ -158,29 +158,17 @@ def main():
|
|
158 |
img.save('tmp.jpg')
|
159 |
predict(col2)
|
160 |
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
if edited_caption:
|
168 |
-
st.markdown("<p style='font-size: 24px; font-weight: bold; margin-bottom: 20px;'>Edited Caption:</p>", unsafe_allow_html=True)
|
169 |
-
st.write(edited_caption)
|
170 |
|
171 |
-
|
172 |
-
if lang != "en":
|
173 |
-
translated_caption = translator.translate(edited_caption, src="en", dest=lang)
|
174 |
-
st.markdown(f"<p style='font-size: 24px; font-weight: bold; margin-bottom: 20px;'>{lang.upper()} Translation:</p>", unsafe_allow_html=True)
|
175 |
-
st.write(translated_caption.text)
|
176 |
|
177 |
-
|
178 |
-
update_caption(username, edited_caption) # Update the caption in the database
|
179 |
-
|
180 |
-
st.success("Caption updated and saved successfully!")
|
181 |
os.remove('tmp.jpg')
|
182 |
-
|
183 |
-
st.info("Caption editing is only available for English language captions.")
|
184 |
else:
|
185 |
st.write("Please login to access this feature.")
|
186 |
|
|
|
158 |
img.save('tmp.jpg')
|
159 |
predict(col2)
|
160 |
|
161 |
+
for lang in selected_languages:
|
162 |
+
if lang != "en":
|
163 |
+
translated_caption = translator.translate(edited_caption, src="en", dest=lang)
|
164 |
+
st.markdown(f"<p style='font-size: 24px; font-weight: bold; margin-bottom: 20px;'>{lang.upper()} Translation:</p>", unsafe_allow_html=True)
|
165 |
+
st.write(translated_caption.text)
|
|
|
|
|
|
|
|
|
166 |
|
167 |
+
# Update the caption in the database
|
|
|
|
|
|
|
|
|
168 |
|
169 |
+
st.success("Caption successfully!")
|
|
|
|
|
|
|
170 |
os.remove('tmp.jpg')
|
171 |
+
|
|
|
172 |
else:
|
173 |
st.write("Please login to access this feature.")
|
174 |
|