Rausda6 commited on
Commit
0ae9b0c
·
verified ·
1 Parent(s): 6d77bea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -195,12 +195,12 @@ class PodcastGenerator:
195
 
196
  def conversation_to_json(self,text: str) -> Dict:
197
  """Convert speaker-formatted text to podcast JSON structure"""
198
- lines = re.findall(r'(Speaker\s[12]):\s*(.+)', text)
199
- podcast = [{"speaker": int(s[-1]), "line": l.strip()} for s, l in lines]
200
- return {
201
- "topic": "Generated from PDF",
202
- "podcast": podcast
203
- }
204
 
205
  def validate_podcast_structure(self, data: Dict) -> bool:
206
  """Validate podcast JSON structure"""
@@ -327,7 +327,7 @@ Speaker 2: ...
327
 
328
  #Example JSON structure:
329
  #{json.dumps(example_json, indent=2)}
330
- user_prompt = user_prompt = f"\nInput Text:\n{prompt}\n\nJSON:"# f"\nTopic: {prompt}\nJSON:"
331
  full_prompt = system_prompt + user_prompt
332
  add_log("🔍 Prompt Preview:\n" + full_prompt[:2000])
333
 
 
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
  def validate_podcast_structure(self, data: Dict) -> bool:
206
  """Validate podcast JSON structure"""
 
327
 
328
  #Example JSON structure:
329
  #{json.dumps(example_json, indent=2)}
330
+ user_prompt = f"\nInput Text:\n{prompt}\n\nPodcast Script:" #user_prompt = user_prompt = f"\nInput Text:\n{prompt}\n\nJSON:"# f"\nTopic: {prompt}\nJSON:"
331
  full_prompt = system_prompt + user_prompt
332
  add_log("🔍 Prompt Preview:\n" + full_prompt[:2000])
333