Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
#import requests
|
3 |
-
|
4 |
from PIL import Image
|
5 |
import os
|
6 |
token = os.environ.get('HF_TOKEN')
|
@@ -8,21 +8,7 @@ whisper_to_gpt = gr.Blocks.load(name="spaces/fffiloni/whisper-to-chatGPT")
|
|
8 |
tts = gr.Interface.load(name="spaces/Flux9665/IMS-Toucan")
|
9 |
talking_face = gr.Blocks.load(name="spaces/fffiloni/one-shot-talking-face", api_key=token)
|
10 |
|
11 |
-
def apply_delay(video_path):
|
12 |
-
|
13 |
-
# Open the video file
|
14 |
-
video = VideoFileClip(video_path)
|
15 |
-
|
16 |
-
# Delay the audio by 1 ms
|
17 |
-
delayed_audio = video.audio.fx(afx.delay, 0.5)
|
18 |
-
|
19 |
-
# Overwrite the original audio with the delayed audio
|
20 |
-
video = video.set_audio(delayed_audio)
|
21 |
-
|
22 |
-
# Save the modified video
|
23 |
-
video.write_videofile("delayed_video.mp4")
|
24 |
|
25 |
-
return "delayed_video.mp4"
|
26 |
|
27 |
def infer(audio):
|
28 |
gpt_response = whisper_to_gpt(audio, "translate", fn_index=0)
|
@@ -31,10 +17,10 @@ def infer(audio):
|
|
31 |
#image = Image.open(r"wise_woman_portrait.png")
|
32 |
portrait_link = talking_face("wise_woman_portrait.png", audio_response, fn_index=0)
|
33 |
|
34 |
-
|
35 |
#portrait_response = requests.get(portrait_link, headers={'Authorization': 'Bearer ' + token})
|
36 |
#print(portrait_response.text)
|
37 |
-
return
|
38 |
|
39 |
title = """
|
40 |
<div style="text-align: center; max-width: 500px; margin: 0 auto;">
|
@@ -95,7 +81,7 @@ with gr.Blocks(css=css) as demo:
|
|
95 |
gr.HTML(title)
|
96 |
|
97 |
with gr.Row():
|
98 |
-
record_input = gr.Audio(source="microphone",type="filepath", show_label=
|
99 |
|
100 |
with gr.Row():
|
101 |
|
|
|
1 |
import gradio as gr
|
2 |
#import requests
|
3 |
+
|
4 |
from PIL import Image
|
5 |
import os
|
6 |
token = os.environ.get('HF_TOKEN')
|
|
|
8 |
tts = gr.Interface.load(name="spaces/Flux9665/IMS-Toucan")
|
9 |
talking_face = gr.Blocks.load(name="spaces/fffiloni/one-shot-talking-face", api_key=token)
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
|
|
12 |
|
13 |
def infer(audio):
|
14 |
gpt_response = whisper_to_gpt(audio, "translate", fn_index=0)
|
|
|
17 |
#image = Image.open(r"wise_woman_portrait.png")
|
18 |
portrait_link = talking_face("wise_woman_portrait.png", audio_response, fn_index=0)
|
19 |
|
20 |
+
|
21 |
#portrait_response = requests.get(portrait_link, headers={'Authorization': 'Bearer ' + token})
|
22 |
#print(portrait_response.text)
|
23 |
+
return portrait_link
|
24 |
|
25 |
title = """
|
26 |
<div style="text-align: center; max-width: 500px; margin: 0 auto;">
|
|
|
81 |
gr.HTML(title)
|
82 |
|
83 |
with gr.Row():
|
84 |
+
record_input = gr.Audio(source="microphone",type="filepath", show_label=True,elem_id="record_btn")
|
85 |
|
86 |
with gr.Row():
|
87 |
|