Rausda6 commited on
Commit
130163b
·
verified ·
1 Parent(s): ed58370

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -239,7 +239,10 @@ Now format the following:
239
 
240
  def conversation_to_json(self, text: str) -> Dict:
241
  """Convert speaker-formatted text to podcast JSON structure"""
242
- lines = re.findall(r'[Ss]peaker\s*([12])\s*:\s*(.*)', text)
 
 
 
243
  podcast = [{"speaker": int(s), "line": l.strip()} for s, l in lines]
244
  return {
245
  "topic": "Generated from Input",
 
239
 
240
  def conversation_to_json(self, text: str) -> Dict:
241
  """Convert speaker-formatted text to podcast JSON structure"""
242
+ def conversation_to_json(self, text: str) -> Dict:
243
+ """Convert speaker-formatted text to podcast JSON structure"""
244
+ # Allow leading whitespace and enforce full line match
245
+ lines = re.findall(r'^\s*Speaker\s*([12])\s*:\s*(.+)', text, flags=re.MULTILINE)
246
  podcast = [{"speaker": int(s), "line": l.strip()} for s, l in lines]
247
  return {
248
  "topic": "Generated from Input",