diff --git a/Day91/main.py b/Day91/main.py index 6e151bd..ecb2cb7 100644 --- a/Day91/main.py +++ b/Day91/main.py @@ -1,5 +1,7 @@ from flask import Flask, render_template, request, redirect, url_for, flash from PyPDF2 import PdfReader +from gtts import gTTS + app = Flask(__name__) app.config['SECRET_KEY'] = 'add-secret-key-here' @@ -19,6 +21,12 @@ def get_pdf_text(pdf_file): return all_text +def convert_and_save_audio(file): + pdf_text = get_pdf_text(file) + print(pdf_text) + text_to_speech = gTTS(pdf_text) + text_to_speech.save(f'{pdf_text}.mp3') + @app.route("/", methods=["GET", "POST"]) def home(): return render_template("index.html")