vilarin commited on
Commit
ba13ad9
·
verified ·
1 Parent(s): a39c20d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -1,8 +1,9 @@
1
- #Codes from killerz3/PodGen & eswardivi/Podcastify
2
  import json
3
  import spaces
4
  import httpx
5
  import os
 
6
  import asyncio
7
  import edge_tts
8
  import torch
@@ -146,7 +147,14 @@ def generator(messages):
146
 
147
  results = tokenizer.decode(output_ids[0][input_ids.shape[1]:], skip_special_tokens=True)
148
  return results
149
-
 
 
 
 
 
 
 
150
 
151
  async def main(link):
152
  if not link.startswith("http://") and not link.startswith("https://"):
@@ -164,7 +172,7 @@ async def main(link):
164
  {"role": "user", "content": prompt},
165
  ]
166
 
167
- generated_script = generator(messages)
168
 
169
  print("Generated Script:"+generated_script)
170
 
 
1
+ #Using codes from killerz3/PodGen & eswardivi/Podcastify
2
  import json
3
  import spaces
4
  import httpx
5
  import os
6
+ import re
7
  import asyncio
8
  import edge_tts
9
  import torch
 
147
 
148
  results = tokenizer.decode(output_ids[0][input_ids.shape[1]:], skip_special_tokens=True)
149
  return results
150
+
151
+ def extract_content(text):
152
+ """Extracts the JSON content from the given text."""
153
+ match = re.search(r'\{.*?\}', text, re.DOTALL)
154
+ if match:
155
+ return match.group(0)
156
+ else:
157
+ return None
158
 
159
  async def main(link):
160
  if not link.startswith("http://") and not link.startswith("https://"):
 
172
  {"role": "user", "content": prompt},
173
  ]
174
 
175
+ generated_script = extract_content(generator(messages))
176
 
177
  print("Generated Script:"+generated_script)
178