Sunday, 28 June 2020

Udemy Certificate for my beginning into machine learning with Python

#udemy #machinelearning #python



Conversion of text in a pdf file to speech(mp3) file using Python

Some of the things which i have started, and that may be useful to somebody whoever interested in these type of below mentioned idea:

I have an idea about how to convert a text in pdf to speech(mp3) file, that may be helpful to the blind people. And also who are seriously in other works and want to read the pdf file, simply by mentioning their file and can run in a Python script.

The below code can give you an illustration of how i converted the pdf text to mp3 file, Just one thing you can mention, file name(with filepath) you have to mention, no need to worry about installation of any libraries. Just simply copy the code and paste in any .py file and run in your command prompt or pycharm or any IDE for python.

Code:
-------
import os

try:
import PyPDF2
except ImportError:
print("Installing Required modules")
os.system('python -m pip install PyPDF2')

try:
import gtts
except ImportError:
print("Installing Required modules")
os.system('python -m pip install gtts')

import PyPDF2
import gtts
from gtts import gTTS
pdfobj=open('pdf file path','rb')# mention the pdf file in .pdf format
pdfReader = PyPDF2.PdfFileReader(pdfobj)
print(pdfReader.numPages)
text3=''
for t1 in range(1,pdfReader.numPages):
text1=pdfReader.getPage(t1)
text2=text1.extractText()
text3=text3+'\n'+text2
pdfobj.close()
obj=gTTS(text=text3,lang='en',slow=False)
#mention the filename with .mp3 format to save in your local disk
obj.save("mp3file.mp3")
-> Continue coding, All the Best

Conversion of Video file(mp4) to an Audio file(mp3)

Some may have a thought about how to listen the audio without video, and also it is not the every individual aspect to listen the audio without seeing the video. Some have a thought about to listen the audio without a video.

The below code can help you in solving your problem.

Run this code using python3 in Your command prompt or any python IDE. Before that install python interpreter in your machine.

import os

try:
import moviepy
except ImportError:
print("Installing required modules")
os.system('python -m pip install moviepy')
print("successfully installed required modules")

import moviepy.editor as mp

try:
# Enter video file path in mp4 format
mp3=mp.VideoFileClip(r"Videofile.mp4")
except FileNotFoundError:
print("Enter the correct Video file path")
finally:
# Enter the audio file to create in mp3 format
mp3.audio.write_audiofile(r"audiofile.mp3")
print("Video file successfully converted to Audio file")

-> All the best, and continue for your success

Saturday, 27 June 2020

Information about the source code management tool GIT and GITHUB repository comands

 Important Information about the GIT Repository useful commands in real-time, which can be helpful for our Source code management process. Feel it will be useful like cheat sheets about GIT and GITHUB repository.