Spaces:
Runtime error
Runtime error
| import streamlit as st | |
| from extractor import extract_ppt_text, extract_pdf_text | |
| from tts_engine import generate_voice | |
| st.title("AI Lecture Voice Generator") | |
| st.write("Convert PPT, PDF, or Text into Indian English or Tamil speech") | |
| uploaded_file = st.file_uploader( | |
| "Upload PPT / PDF / TXT", | |
| type=["pptx","pdf","txt"] | |
| ) | |
| text_data = "" | |
| if uploaded_file: | |
| if uploaded_file.name.endswith(".pptx"): | |
| text_data = extract_ppt_text(uploaded_file) | |
| elif uploaded_file.name.endswith(".pdf"): | |
| text_data = extract_pdf_text(uploaded_file) | |
| else: | |
| text_data = uploaded_file.read().decode() | |
| st.text_area("Extracted Text", text_data, height=200) | |
| if st.button("Generate Speech"): | |
| if text_data == "": | |
| st.warning("Upload a file first") | |
| else: | |
| audio = generate_voice(text_data) | |
| st.audio(audio) |