cool
Browse files
App/Generate/database/Model.py
CHANGED
@@ -8,7 +8,7 @@ from .Vercel import AsyncImageGenerator
|
|
8 |
import aiohttp
|
9 |
from typing import List
|
10 |
|
11 |
-
database_url = "
|
12 |
database = databases.Database(database_url)
|
13 |
models = orm.ModelRegistry(database=database)
|
14 |
|
|
|
8 |
import aiohttp
|
9 |
from typing import List
|
10 |
|
11 |
+
database_url = "sqlite+aiosqlite:///ok.db"
|
12 |
database = databases.Database(database_url)
|
13 |
models = orm.ModelRegistry(database=database)
|
14 |
|
App/Generate/generatorRoutes.py
CHANGED
@@ -4,7 +4,7 @@ from .utils.GroqInstruct import chatbot
|
|
4 |
from .Story.Story import Story
|
5 |
import asyncio, pprint, json
|
6 |
from tqdm import tqdm
|
7 |
-
from .database.Model import models, database_url, Scene, Project
|
8 |
from .utils.RenderVideo import RenderVideo
|
9 |
from .Prompts.StoryGen import Prompt
|
10 |
from App.Editor.editorRoutes import celery_task, EditorRequest
|
@@ -18,7 +18,13 @@ async def update_scene(model_scene):
|
|
18 |
async def main(request: GeneratorRequest):
|
19 |
topic = request.prompt
|
20 |
renderr = RenderVideo()
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
message = chatbot(Prompt.format(topic=topic))
|
23 |
|
24 |
generated_story = Story.from_dict(message["scenes"])
|
|
|
4 |
from .Story.Story import Story
|
5 |
import asyncio, pprint, json
|
6 |
from tqdm import tqdm
|
7 |
+
from .database.Model import models, database_url, Scene, Project, database
|
8 |
from .utils.RenderVideo import RenderVideo
|
9 |
from .Prompts.StoryGen import Prompt
|
10 |
from App.Editor.editorRoutes import celery_task, EditorRequest
|
|
|
18 |
async def main(request: GeneratorRequest):
|
19 |
topic = request.prompt
|
20 |
renderr = RenderVideo()
|
21 |
+
try:
|
22 |
+
await models._create_all(database_url)
|
23 |
+
except:
|
24 |
+
pass
|
25 |
+
finally:
|
26 |
+
if not database.is_connected:
|
27 |
+
await database.connect()
|
28 |
message = chatbot(Prompt.format(topic=topic))
|
29 |
|
30 |
generated_story = Story.from_dict(message["scenes"])
|