Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +22 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
+
import torch
|
4 |
+
|
5 |
+
# Load the text-to-text generation pipeline
|
6 |
+
pipe = pipeline("text2text-generation", model="samanjoy2/bn2ipa_TwoBraincells", device='cpu')
|
7 |
+
|
8 |
+
st.title("Bangla Text to IPA Transcription")
|
9 |
+
|
10 |
+
# User input for text generation
|
11 |
+
input_text = st.text_area("Enter Bangla text for IPA Transcription:", max_chars=400)
|
12 |
+
|
13 |
+
if st.button("Generate IPA"):
|
14 |
+
if input_text:
|
15 |
+
# Generate text using the pipeline
|
16 |
+
generated_text = pipe(input_text, max_length=512, batch_size=1)[0]['generated_text']
|
17 |
+
|
18 |
+
# Display the generated text
|
19 |
+
st.subheader("Generated IPA:")
|
20 |
+
st.write(generated_text)
|
21 |
+
else:
|
22 |
+
st.warning("Please enter text for generation.")
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
transformers
|
3 |
+
torch
|