Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -258,6 +258,29 @@ if uploaded_file:
|
|
258 |
with col2:
|
259 |
with open(img_path, "rb") as img_file:
|
260 |
st.download_button("๐ผ๏ธ English Image", data=img_file, file_name="medicine_analysis.png", mime="image/png")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
|
262 |
# if response and st.button("๐ Translate to Hindi"):
|
263 |
# with st.spinner("Translating to Hindi..."):
|
|
|
258 |
with col2:
|
259 |
with open(img_path, "rb") as img_file:
|
260 |
st.download_button("๐ผ๏ธ English Image", data=img_file, file_name="medicine_analysis.png", mime="image/png")
|
261 |
+
|
262 |
+
|
263 |
+
|
264 |
+
if response and st.button("๐ Translate to Hindi"):
|
265 |
+
with st.spinner("Translating to Hindi..."):
|
266 |
+
try:
|
267 |
+
hindi_text = GoogleTranslator(source='en', target='hi').translate(filtered_output)
|
268 |
+
except Exception as e:
|
269 |
+
hindi_text = "[Error translating text]"
|
270 |
+
|
271 |
+
st.markdown("#### ๐ Hindi Translation")
|
272 |
+
st.text_area("Translated Output (Hindi)", hindi_text, height=300)
|
273 |
+
|
274 |
+
hindi_img_path = "hindi_output.png"
|
275 |
+
save_text_as_image(hindi_text, hindi_img_path)
|
276 |
+
|
277 |
+
st.markdown("#### ๐ฅ Download (Hindi)")
|
278 |
+
col3, col4 = st.columns(2)
|
279 |
+
with col3:
|
280 |
+
st.download_button("โฌ๏ธ Hindi TXT", data=hindi_text.encode(), file_name="hindi_medicine_analysis.txt")
|
281 |
+
with col4:
|
282 |
+
with open(hindi_img_path, "rb") as img_file:
|
283 |
+
st.download_button("๐ผ๏ธ Hindi Image", data=img_file, file_name="hindi_medicine_analysis.png", mime="image/png")
|
284 |
|
285 |
# if response and st.button("๐ Translate to Hindi"):
|
286 |
# with st.spinner("Translating to Hindi..."):
|