saiful9379 / pybangla

Text Normalizer module use for Bangla as well as English digit convert to textual format, Normalize Date and Extract Date
11 stars 4 forks source link

Typo error "soved date format issue" and requesting code modification on my main.py with pybangla #13

Closed khandakershahi closed 3 months ago

khandakershahi commented 3 months ago

First, thanks for building the pybangla package.

A typo error on https://github.com/saiful9379/pybangla/commit/05f9e895b916fdd60b167117be96a00eead9666a "soved date format issue"

And a request, not a python coder. Can you please modify the code below so it recognizes the Bengali years?


import torch
from TTS.api import TTS
import gradio as gr

device = "cuda" if torch.cuda.is_available() else "cpu"

def generate_audio(text="তুমি কেমন আছো?"):
    tts = TTS(model_name='tts_models/bn/custom/vits-male').to(device)
    tts.tts_to_file(text=text, file_path="outputs/output.wav")
    return "outputs/output.wav"

demo = gr.Interface(
    fn=generate_audio,
    inputs=[gr.Text(label="Text"),],
    outputs=[gr.Audio(label="Audio"),],
    )

demo.launch()

coqui-ai / TTS did provide me some code with mine but it don't prounice bengali year as "১৯৮৭-র" to "উনিশশো সাতাশি এর" rather just plain number in bengali.

Here is th link

Thanks.

saiful9379 commented 3 months ago

@khandakershahi, if your problem is year check the date_format or you can use this normalizer, it will solve the Date Normalization as well.

khandakershahi commented 3 months ago

I don't know python coding. These codes I got from YouTube. If I know how to use with GUI by coding, I wouldn't ask you for help. In TTS GitHub, they help me with update code. I was hoping a similar thing. But not everybody has time to help or will. Still I ask.

Thanks for your package. But I guess I won't be able to use it, as I don't know python coding. Neither someone created a tutorial on anywhere how to use it with GUI for the Bengali or May be in my search I didn't find it.

saiful9379 commented 3 months ago

Please check the codebase it will solved your problem, i hope. pip install pybangla

import torch
from TTS.api import TTS
import gradio as gr

import pybangla
nrml = pybangla.Normalizer()

device = "cuda" if torch.cuda.is_available() else "cpu"
text = "তুমি কেমন আছো?"

def generate_audio(text=text):
    text = nrml.text_normalizer(text)
    tts = TTS(model_name='tts_models/bn/custom/vits-male').to(device)
    tts.tts_to_file(text=text, file_path="outputs/output.wav")
    return "outputs/output.wav"

demo = gr.Interface(
    fn=generate_audio,
    inputs=[gr.Text(label="Text"),],
    outputs=[gr.Audio(label="Audio"),],
    )

demo.launch()
khandakershahi commented 3 months ago

Thanks it works. Really appreciate it.