akki2825 commited on
Commit
6df0a02
·
verified ·
1 Parent(s): c74db10
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -1,13 +1,14 @@
1
  import gradio as gr
2
 
3
  def split_into_sentences(text):
4
- # Split the text by newline characters
5
- sentences = text.split('\n')
6
 
7
- # Clean up any leading/trailing whitespace in each sentence
8
- sentences = [s.strip() for s in sentences]
 
9
 
10
- # Join the sentences with newline characters to display each on a new line
11
  return '\n'.join(sentences)
12
 
13
  def main():
 
1
  import gradio as gr
2
 
3
  def split_into_sentences(text):
4
+ # Split the text into sentences based on periods followed by spaces
5
+ sentences = text.split('. ')
6
 
7
+ # Add a period back to each sentence except the last one if it doesn't end with a period
8
+ for i in range(len(sentences) - 1):
9
+ sentences[i] += '.'
10
 
11
+ # Join the sentences with newline characters
12
  return '\n'.join(sentences)
13
 
14
  def main():