Spaces:
Runtime error
Runtime error
abilshr
commited on
Commit
•
8afce93
0
Parent(s):
Week 2 Hw
Browse files
.gitattributes
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Text-To-Speech
|
3 |
+
emoji: 🎤
|
4 |
+
colorFrom: pink
|
5 |
+
colorTo: indigo
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 4.18.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
---
|
app.py
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from gradio_client import Client
|
3 |
+
|
4 |
+
def get_speech(text, voice):
|
5 |
+
client = Client("https://collabora-whisperspeech.hf.space/")
|
6 |
+
result = client.predict(
|
7 |
+
text, # str in 'Enter multilingual text💬📝' Textbox component
|
8 |
+
voice, # filepath in 'Upload or Record Speaker Audio (optional)🌬️💬' Audio component
|
9 |
+
"", # str in 'alternatively, you can paste in an audio file URL:' Textbox component
|
10 |
+
14, # float (numeric value between 10 and 15) in 'Tempo (in characters per second)' Slider component
|
11 |
+
api_name="/whisper_speech_demo"
|
12 |
+
)
|
13 |
+
print(result)
|
14 |
+
return result
|
15 |
+
|
16 |
+
def get_dreamtalk(image_in, speech):
|
17 |
+
client = Client("https://fffiloni-dreamtalk.hf.space/")
|
18 |
+
result = client.predict(
|
19 |
+
speech, # filepath in 'Audio input' Audio component
|
20 |
+
image_in, # filepath in 'Image' Image component
|
21 |
+
"M030_front_neutral_level1_001.mat", # Literal['M030_front_angry_level3_001.mat', 'M030_front_contempt_level3_001.mat', 'M030_front_disgusted_level3_001.mat', 'M030_front_fear_level3_001.mat', 'M030_front_happy_level3_001.mat', 'M030_front_neutral_level1_001.mat', 'M030_front_sad_level3_001.mat', 'M030_front_surprised_level3_001.mat', 'W009_front_angry_level3_001.mat', 'W009_front_contempt_level3_001.mat', 'W009_front_disgusted_level3_001.mat', 'W009_front_fear_level3_001.mat', 'W009_front_happy_level3_001.mat', 'W009_front_neutral_level1_001.mat', 'W009_front_sad_level3_001.mat', 'W009_front_surprised_level3_001.mat', 'W011_front_angry_level3_001.mat', 'W011_front_contempt_level3_001.mat', 'W011_front_disgusted_level3_001.mat', 'W011_front_fear_level3_001.mat', 'W011_front_happy_level3_001.mat', 'W011_front_neutral_level1_001.mat', 'W011_front_sad_level3_001.mat', 'W011_front_surprised_level3_001.mat'] in 'emotional style' Dropdown component
|
22 |
+
api_name="/infer"
|
23 |
+
)
|
24 |
+
print(result)
|
25 |
+
return result['video']
|
26 |
+
|
27 |
+
def pipe (text, voice, image_in):
|
28 |
+
|
29 |
+
speech = get_speech(text, voice)
|
30 |
+
|
31 |
+
try:
|
32 |
+
video = get_dreamtalk(image_in, speech)
|
33 |
+
except:
|
34 |
+
|
35 |
+
raise gr.Error('An error occurred while loading DreamTalk: Image may not contain any face')
|
36 |
+
|
37 |
+
return video
|
38 |
+
|
39 |
+
with gr.Blocks() as demo:
|
40 |
+
with gr.Column():
|
41 |
+
gr.HTML("""
|
42 |
+
<h2 style="text-align: center;">
|
43 |
+
Text To Video
|
44 |
+
</h2>
|
45 |
+
<p style="text-align: center;"></p>
|
46 |
+
""")
|
47 |
+
with gr.Row():
|
48 |
+
with gr.Column():
|
49 |
+
image_in = gr.Image(label="Portrait IN", type="filepath", value="https://ibb.co/KK9c5qF")
|
50 |
+
with gr.Column():
|
51 |
+
voice = gr.Audio(type="filepath", label="Upload or Record Speaker audio (Optional voice cloning)")
|
52 |
+
text = gr.Textbox(label="text")
|
53 |
+
submit_btn = gr.Button('Submit')
|
54 |
+
with gr.Column():
|
55 |
+
video_o = gr.Video(label="Video result")
|
56 |
+
submit_btn.click(
|
57 |
+
fn = pipe,
|
58 |
+
inputs = [
|
59 |
+
text, voice, image_in
|
60 |
+
],
|
61 |
+
outputs = [
|
62 |
+
video_o
|
63 |
+
],
|
64 |
+
concurrency_limit = 3
|
65 |
+
)
|
66 |
+
demo.queue(max_size=10).launch(show_error=True, show_api=False)
|
d
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[33mcommit 55f9626addc1af2d59d87a32e3a7d4685026713d[m[33m ([m[1;36mHEAD[m[33m -> [m[1;32mmain[m[33m)[m
|
2 |
+
Author: csi-Abil <abil.shrestha@cix.csi.cuny.edu>
|
3 |
+
Date: Fri Feb 23 01:18:48 2024 -0500
|
4 |
+
|
5 |
+
week2 HW
|
6 |
+
|
7 |
+
[33mcommit 5352e99247879fb2ee69af28670f72ce4e04f900[m
|
8 |
+
Author: csi-Abil <abil.shrestha@cix.csi.cuny.edu>
|
9 |
+
Date: Fri Feb 23 01:13:33 2024 -0500
|
10 |
+
|
11 |
+
Week 2 CTP
|
12 |
+
|
13 |
+
[33mcommit f4d843f856f21f1f0f64db1a2fe9171646b2cfeb[m[33m ([m[1;31morigin/main[m[33m, [m[1;31morigin/HEAD[m[33m)[m
|
14 |
+
Author: Abil <abil-ml@users.noreply.huggingface.co>
|
15 |
+
Date: Fri Feb 23 05:37:14 2024 +0000
|
16 |
+
|
17 |
+
initial commit
|