Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,6 @@ import easyocr
|
|
| 10 |
import cv2
|
| 11 |
import numpy as np
|
| 12 |
import time
|
| 13 |
-
import asyncio
|
| 14 |
|
| 15 |
# Page configuration
|
| 16 |
st.set_page_config(
|
|
@@ -271,20 +270,19 @@ if selected_tab == "Audio Transcription":
|
|
| 271 |
progress_bar = simulate_progress()
|
| 272 |
|
| 273 |
try:
|
| 274 |
-
translation =
|
| 275 |
-
|
| 276 |
-
))
|
| 277 |
-
st.session_state.translated_text = translation.text
|
| 278 |
st.success("β
Translation complete!")
|
| 279 |
except Exception as e:
|
| 280 |
st.error(f"Error during translation: {str(e)}")
|
| 281 |
|
| 282 |
if st.session_state.translated_text:
|
| 283 |
st.text_area(
|
| 284 |
-
f"Translated to {
|
| 285 |
-
st.session_state.
|
| 286 |
height=200
|
| 287 |
)
|
|
|
|
| 288 |
else:
|
| 289 |
st.info("Translated text will appear here after processing.")
|
| 290 |
|
|
@@ -384,17 +382,18 @@ elif selected_tab == "Image OCR":
|
|
| 384 |
# st.session_state.extracted_text, dest=language
|
| 385 |
#))
|
| 386 |
translation = translate_text(st.session_state.extracted_text, target_language=language)
|
| 387 |
-
st.session_state.translated_ocr_text = translation
|
| 388 |
st.success("β
Translation complete!")
|
| 389 |
except Exception as e:
|
| 390 |
st.error(f"Error during translation: {str(e)}")
|
| 391 |
|
| 392 |
if st.session_state.translated_ocr_text:
|
| 393 |
st.text_area(
|
| 394 |
-
f"Translated to {
|
| 395 |
st.session_state.translated_ocr_text,
|
| 396 |
height=150
|
| 397 |
)
|
|
|
|
| 398 |
else:
|
| 399 |
st.info("Translated text will appear here after processing.")
|
| 400 |
|
|
|
|
| 10 |
import cv2
|
| 11 |
import numpy as np
|
| 12 |
import time
|
|
|
|
| 13 |
|
| 14 |
# Page configuration
|
| 15 |
st.set_page_config(
|
|
|
|
| 270 |
progress_bar = simulate_progress()
|
| 271 |
|
| 272 |
try:
|
| 273 |
+
translation = translate_text(st.session_state.extracted_text, target_language=language)
|
| 274 |
+
st.session_state.translated_ocr_text = translation
|
|
|
|
|
|
|
| 275 |
st.success("β
Translation complete!")
|
| 276 |
except Exception as e:
|
| 277 |
st.error(f"Error during translation: {str(e)}")
|
| 278 |
|
| 279 |
if st.session_state.translated_text:
|
| 280 |
st.text_area(
|
| 281 |
+
f"Translated to {language.capitalize()}:",
|
| 282 |
+
st.session_state.translated_ocr_text,
|
| 283 |
height=200
|
| 284 |
)
|
| 285 |
+
)
|
| 286 |
else:
|
| 287 |
st.info("Translated text will appear here after processing.")
|
| 288 |
|
|
|
|
| 382 |
# st.session_state.extracted_text, dest=language
|
| 383 |
#))
|
| 384 |
translation = translate_text(st.session_state.extracted_text, target_language=language)
|
| 385 |
+
st.session_state.translated_ocr_text = translation
|
| 386 |
st.success("β
Translation complete!")
|
| 387 |
except Exception as e:
|
| 388 |
st.error(f"Error during translation: {str(e)}")
|
| 389 |
|
| 390 |
if st.session_state.translated_ocr_text:
|
| 391 |
st.text_area(
|
| 392 |
+
f"Translated to {language.capitalize()}:",
|
| 393 |
st.session_state.translated_ocr_text,
|
| 394 |
height=150
|
| 395 |
)
|
| 396 |
+
|
| 397 |
else:
|
| 398 |
st.info("Translated text will appear here after processing.")
|
| 399 |
|