Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -193,14 +193,15 @@ class PodcastGenerator:
|
|
193 |
add_log("⚠️ No valid JSON found, creating fallback")
|
194 |
return self.create_fallback_podcast(text)
|
195 |
|
196 |
-
def conversation_to_json(self,text: str) -> Dict:
|
197 |
"""Convert speaker-formatted text to podcast JSON structure"""
|
198 |
-
lines = re.findall(r'[Ss]peaker\s*([12])\s*:\s*(
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
|
|
204 |
|
205 |
def validate_podcast_structure(self, data: Dict) -> bool:
|
206 |
"""Validate podcast JSON structure"""
|
|
|
193 |
add_log("⚠️ No valid JSON found, creating fallback")
|
194 |
return self.create_fallback_podcast(text)
|
195 |
|
196 |
+
def conversation_to_json(self, text: str) -> Dict:
|
197 |
"""Convert speaker-formatted text to podcast JSON structure"""
|
198 |
+
lines = re.findall(r'[Ss]peaker\s*([12])\s*:\s*(.*)', text)
|
199 |
+
podcast = [{"speaker": int(s), "line": l.strip()} for s, l in lines]
|
200 |
+
return {
|
201 |
+
"topic": "Generated from Input",
|
202 |
+
"podcast": podcast
|
203 |
+
}
|
204 |
+
|
205 |
|
206 |
def validate_podcast_structure(self, data: Dict) -> bool:
|
207 |
"""Validate podcast JSON structure"""
|