File size: 871 Bytes
7b2df7f
 
 
 
 
f4e2930
7b2df7f
 
073451d
f4e2930
7b2df7f
f4e2930
073451d
7b2df7f
 
 
f4e2930
7b2df7f
 
 
f4e2930
 
 
 
 
7b2df7f
f4e2930
 
 
7b2df7f
 
 
f4e2930
 
 
7b2df7f
 
f4e2930
7b2df7f
 
 
f4e2930
 
 
 
073451d
7b2df7f
f4e2930
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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)