samanjoy2 commited on
Commit
d075973
·
1 Parent(s): e29a0e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -5,18 +5,21 @@ import torch
5
  # Load the text-to-text generation pipeline
6
  pipe = pipeline("text2text-generation", model="samanjoy2/bnpunct_banglat5_seq2seq_finetuned", device='cpu')
7
 
8
- st.title("Bangla Punctutation Restoration")
 
9
 
10
  # User input for text generation
11
  input_text = st.text_area("Enter Bangla text for restoration:", max_chars=400)
12
 
13
  if st.button("Restore Punctuations"):
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 Text:")
20
  st.write(generated_text)
21
  else:
22
- st.warning("Please enter text for generation.")
 
5
  # Load the text-to-text generation pipeline
6
  pipe = pipeline("text2text-generation", model="samanjoy2/bnpunct_banglat5_seq2seq_finetuned", device='cpu')
7
 
8
+ st.title("Bangla Punctutation Restoration 🔨")
9
+ st.header("Input in Bengali text and get corrected output with proper punctuation marks [। , ?]")
10
 
11
  # User input for text generation
12
  input_text = st.text_area("Enter Bangla text for restoration:", max_chars=400)
13
 
14
  if st.button("Restore Punctuations"):
15
  if input_text:
16
+ # Remove the Punctuations if there are any
17
+ input_text = input_text.replace('।', '').replace(',', '').replace('?', '')
18
  # Generate text using the pipeline
19
  generated_text = pipe(input_text, max_length=512, batch_size=1)[0]['generated_text']
20
 
21
  # Display the generated text
22
+ st.subheader("Restored Text:")
23
  st.write(generated_text)
24
  else:
25
+ st.warning("Please enter text for restoration.")