Mbonea commited on
Commit
3cdca98
1 Parent(s): cec2e17

temporary file

Browse files
Files changed (1) hide show
  1. App/Generate/database/Model.py +9 -6
App/Generate/database/Model.py CHANGED
@@ -8,9 +8,14 @@ from .Vercel import AsyncImageGenerator
8
  import aiohttp
9
  from typing import List
10
  from pydantic import BaseModel
 
11
  import json
12
 
13
- SUPABASE = os.environ.get("SUPABASE", "RANDOM_STRING")
 
 
 
 
14
  database_url = SUPABASE
15
  database = databases.Database(database_url)
16
  models = orm.ModelRegistry(database=database)
@@ -158,7 +163,7 @@ class Project(orm.Model):
158
 
159
 
160
  class Scene(orm.Model):
161
- tts = Speak()
162
  tablename = "scenes"
163
  registry = models
164
  fields = {
@@ -178,10 +183,9 @@ class Scene(orm.Model):
178
  }
179
 
180
  async def generate_scene_transcript(self, offset):
181
- tts = Speak()
182
  links = [self.narration_link]
183
  text = self.narration + " master"
184
- transcript = await tts._make_transcript(links=links, text=text)
185
  return transform_alignment_data(data=transcript, offset=offset)
186
 
187
  async def generate_scene_data(self):
@@ -196,11 +200,10 @@ class Scene(orm.Model):
196
 
197
  async def retry_narration_generation(self):
198
  print(self.narration)
199
- tts = Speak()
200
  retry_count = 0
201
  while retry_count < 3:
202
  try:
203
- return await tts.say(
204
  text=self.narration + " master"
205
  ) ### The blanks help to even stuff up.
206
  except Exception as e:
 
8
  import aiohttp
9
  from typing import List
10
  from pydantic import BaseModel
11
+ import tempfile
12
  import json
13
 
14
+
15
+ SUPABASE = os.environ.get(
16
+ "SUPABASE",
17
+ "postgresql+asyncpg://postgres.djnpqggqnsnunrnqyqal:3TFrfnDVHvu5Mfsp@aws-0-us-east-1.pooler.supabase.com:5432/postgres",
18
+ )
19
  database_url = SUPABASE
20
  database = databases.Database(database_url)
21
  models = orm.ModelRegistry(database=database)
 
163
 
164
 
165
  class Scene(orm.Model):
166
+ tts = Speak(dir=tempfile.mkdtemp())
167
  tablename = "scenes"
168
  registry = models
169
  fields = {
 
183
  }
184
 
185
  async def generate_scene_transcript(self, offset):
 
186
  links = [self.narration_link]
187
  text = self.narration + " master"
188
+ transcript = await self.tts._make_transcript(links=links, text=text)
189
  return transform_alignment_data(data=transcript, offset=offset)
190
 
191
  async def generate_scene_data(self):
 
200
 
201
  async def retry_narration_generation(self):
202
  print(self.narration)
 
203
  retry_count = 0
204
  while retry_count < 3:
205
  try:
206
+ return await self.tts.say(
207
  text=self.narration + " master"
208
  ) ### The blanks help to even stuff up.
209
  except Exception as e: