SPACERUNNER99 commited on
Commit
9db224a
·
verified ·
1 Parent(s): 193897b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -17,29 +17,31 @@ def main(url, parameters, progress=gr.Progress()):
17
  yield "پردازش شروع شد", None
18
  time.sleep(2)
19
 
20
- progress(0.35, desc="تبدیل متن به صوت")
21
  yield "تبدیل متن به صوت", None
22
  client = Client("rayesh/transcribe")
23
- srt_file, video, mp3_file = client.predict(
24
  url=url,
25
  api_name="/transcribe"
26
  )
 
27
  client.close()
28
  print(mp3_file)
29
  progress(0.55, desc="در حال ترجمه")
30
  yield "در حال ترجمه", None
31
  client = Client("rayesh/translate")
32
- subtitle_file = client.predict(
33
  file=handle_file(srt_file),
34
  max_chars=3000,
35
  api_name="/translate"
36
  )
 
37
  client.close()
38
 
39
  progress(1.0, desc="Video editing complete")
40
  yield "درحال پردازش ویدئو", None
41
  client = Client("SPACERUNNER99/video_edite")
42
- output_video_file = client.predict(
43
  srt=handle_file(subtitle_file),
44
  input_video={"video":handle_file(video["video"])},
45
  color=font_color,
@@ -48,6 +50,7 @@ def main(url, parameters, progress=gr.Progress()):
48
  input_audio=handle_file(mp3_file),
49
  api_name="/video_edit"
50
  )
 
51
  client.close()
52
  output_video_file = output_video_file['video']
53
  yield "درحال پردازش ویدئو", output_video_file
 
17
  yield "پردازش شروع شد", None
18
  time.sleep(2)
19
 
20
+ progress(0.35, desc="تبدیل صوت به متن")
21
  yield "تبدیل متن به صوت", None
22
  client = Client("rayesh/transcribe")
23
+ job = client.submit(
24
  url=url,
25
  api_name="/transcribe"
26
  )
27
+ srt_file, video, mp3_file = job.outputs()
28
  client.close()
29
  print(mp3_file)
30
  progress(0.55, desc="در حال ترجمه")
31
  yield "در حال ترجمه", None
32
  client = Client("rayesh/translate")
33
+ job = client.submit(
34
  file=handle_file(srt_file),
35
  max_chars=3000,
36
  api_name="/translate"
37
  )
38
+ subtitle_file = job.outputs()
39
  client.close()
40
 
41
  progress(1.0, desc="Video editing complete")
42
  yield "درحال پردازش ویدئو", None
43
  client = Client("SPACERUNNER99/video_edite")
44
+ job = client.submit(
45
  srt=handle_file(subtitle_file),
46
  input_video={"video":handle_file(video["video"])},
47
  color=font_color,
 
50
  input_audio=handle_file(mp3_file),
51
  api_name="/video_edit"
52
  )
53
+ output_video_file = job.outputs()
54
  client.close()
55
  output_video_file = output_video_file['video']
56
  yield "درحال پردازش ویدئو", output_video_file