Spaces:
Paused
Paused
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
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",
|