Mbonea commited on
Commit
e4cabb3
2 Parent(s): 3546fad 21682d1

Merge branch 'main' of https://huggingface.co/spaces/Yakova/Rectifier

Browse files
App/Worker.py CHANGED
@@ -189,30 +189,21 @@ async def cleanup_temp_directory(
189
  chat_id: int = -1002069945904,
190
  ):
191
  video_folder_dir = f"/tmp/Video/{video_task.constants.task}"
 
192
  try:
193
- if not SERVER_STATE.MASTER:
194
- await upload_file(
195
- output_dir,
196
- SERVER_STATE.SPACE_HOST,
197
- video_task.constants.chunk,
198
- video_task.constants.task,
199
- )
200
- else:
201
 
202
- os.makedirs(video_folder_dir, exist_ok=True)
203
- shutil.move(
204
- output_dir, f"{video_folder_dir}/{video_task.constants.chunk}.mp4"
205
- )
206
 
207
- except Exception as e:
208
- print(e)
209
  finally:
210
- remotion_app_dir = os.path.join("/srv", "Remotion-app")
211
- shutil.rmtree(remotion_app_dir)
212
  # use the cache
213
- shutil.copytree(temp_dir, remotion_app_dir)
214
- if not SERVER_STATE.CACHED:
215
- SERVER_STATE.CACHED = True
216
  # Cleanup: Remove the temporary directory
217
  shutil.rmtree(temp_dir, ignore_errors=True)
218
 
@@ -235,7 +226,7 @@ async def celery_task(video_task: EditorRequest):
235
  create_json_file(video_task.assets, assets_dir)
236
  download_assets(video_task.links, temp_dir)
237
  render_video(temp_dir, output_dir)
238
- unsilence(temp_dir)
239
  await cleanup_temp_directory(temp_dir, output_dir, video_task)
240
 
241
  # chain(
 
189
  chat_id: int = -1002069945904,
190
  ):
191
  video_folder_dir = f"/tmp/Video/{video_task.constants.task}"
192
+
193
  try:
194
+ print("sending...")
195
+ # bot.send_video(chat_id=chat_id,caption="Your Video Caption",file_name=output_dir)
196
+ await bot.send_file(chat_id, file=output_dir, caption="Your video caption")
197
+
 
 
 
 
198
 
 
 
 
 
199
 
 
 
200
  finally:
201
+ #remotion_app_dir = os.path.join("/srv", "Remotion-app")
202
+ #shutil.rmtree(remotion_app_dir)
203
  # use the cache
204
+ #shutil.copytree(temp_dir, remotion_app_dir)
205
+ #if not SERVER_STATE.CACHED:
206
+ # SERVER_STATE.CACHED = True
207
  # Cleanup: Remove the temporary directory
208
  shutil.rmtree(temp_dir, ignore_errors=True)
209
 
 
226
  create_json_file(video_task.assets, assets_dir)
227
  download_assets(video_task.links, temp_dir)
228
  render_video(temp_dir, output_dir)
229
+ #unsilence(temp_dir)
230
  await cleanup_temp_directory(temp_dir, output_dir, video_task)
231
 
232
  # chain(
App/app.py CHANGED
@@ -10,11 +10,12 @@ manager = WorkerClient()
10
 
11
  @app.on_event("startup")
12
  async def startup_event():
13
- if SERVER_STATE.MASTER:
14
- await bot.start()
15
- response = await manager.register_worker()
16
- if not response:
17
- print("Error registering worker")
 
18
 
19
 
20
  @app.get("/")
 
10
 
11
  @app.on_event("startup")
12
  async def startup_event():
13
+ await bot.start()
14
+ #if SERVER_STATE.MASTER:
15
+
16
+ #response = await manager.register_worker()
17
+ #if not response:
18
+ # print("Error registering worker")
19
 
20
 
21
  @app.get("/")
Dockerfile CHANGED
@@ -62,7 +62,7 @@ COPY --chown=admin . /srv
62
  # Command to run the application
63
  # CMD python -m uvicorn App.app:app --host 0.0.0.0 --port 7860 & python -m celery -A App.Worker.celery worker -c 5 --max-tasks-per-child=1 --without-heartbeat
64
 
65
- CMD python -m uvicorn App.app:app --host 0.0.0.0 --port 7860
66
 
67
  # Expose port
68
  EXPOSE 7860
 
62
  # Command to run the application
63
  # CMD python -m uvicorn App.app:app --host 0.0.0.0 --port 7860 & python -m celery -A App.Worker.celery worker -c 5 --max-tasks-per-child=1 --without-heartbeat
64
 
65
+ CMD python -m uvicorn App.app:app --workers 4 --host 0.0.0.0 --port 7860
66
 
67
  # Expose port
68
  EXPOSE 7860
Remotion-app/remotion.config.js CHANGED
@@ -10,6 +10,6 @@ Config.overrideWebpackConfig((currentConfiguration) => {
10
  return enableTailwind(currentConfiguration);
11
  });
12
 
13
- Config.setC;
14
  Config.setVideoImageFormat('jpeg');
15
  Config.setConcurrency(1);
 
10
  return enableTailwind(currentConfiguration);
11
  });
12
 
13
+ //Config.setBrowserExecutable("/usr/bin/chrome-headless-shell");
14
  Config.setVideoImageFormat('jpeg');
15
  Config.setConcurrency(1);
Remotion-app/src/HelloWorld/index.jsx CHANGED
@@ -10,8 +10,9 @@ const HelloWorld = React.memo(() => {
10
  return (
11
  <AbsoluteFill style={{position: 'relative', backgroundColor: 'black'}}>
12
  <BackgroundStream />
13
- <ImageStream />
14
- <TextStream />
 
15
  <VideoStream />
16
  <AudioStream />
17
  </AbsoluteFill>
 
10
  return (
11
  <AbsoluteFill style={{position: 'relative', backgroundColor: 'black'}}>
12
  <BackgroundStream />
13
+ <ImageStream />
14
+
15
+ <TextStream />
16
  <VideoStream />
17
  <AudioStream />
18
  </AbsoluteFill>