fffiloni commited on
Commit
2006d53
1 Parent(s): 779f8e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -48,10 +48,14 @@ def infer(image_input):
48
 
49
  result = get_text_after_colon(result)
50
 
51
- # Use regular expressions to find new lines and insert spaces between paragraphs
52
- new_text = re.sub(r"\n\s+", "\n \n", result)
 
 
 
 
53
 
54
- return new_text, gr.Group.update(visible=True)
55
 
56
  css="""
57
  #col-container {max-width: 910px; margin-left: auto; margin-right: auto;}
 
48
 
49
  result = get_text_after_colon(result)
50
 
51
+ # Split the text into paragraphs based on new lines
52
+ paragraphs = result.split('\n\n')
53
+
54
+ # Join the paragraphs back with an extra empty line between each paragraph
55
+ formatted_text = '\n\n'.join(paragraphs)
56
+
57
 
58
+ return formatted_text, gr.Group.update(visible=True)
59
 
60
  css="""
61
  #col-container {max-width: 910px; margin-left: auto; margin-right: auto;}