File size: 735 Bytes
b7d8ebc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import streamlit as st
from transformers import pipeline
import torch

# Load the text-to-text generation pipeline
pipe = pipeline("text2text-generation", model="samanjoy2/bn2ipa_TwoBraincells", device='cpu')

st.title("Bangla Text to IPA Transcription")

# User input for text generation
input_text = st.text_area("Enter Bangla text for IPA Transcription:", max_chars=400)

if st.button("Generate IPA"):
    if input_text:
        # Generate text using the pipeline
        generated_text = pipe(input_text, max_length=512, batch_size=1)[0]['generated_text']

        # Display the generated text
        st.subheader("Generated IPA:")
        st.write(generated_text)
    else:
        st.warning("Please enter text for generation.")