fffiloni commited on
Commit
340d310
1 Parent(s): a6e2b69

update apis

Browse files
Files changed (1) hide show
  1. app.py +14 -12
app.py CHANGED
@@ -1,25 +1,27 @@
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']
 
1
  import gradio as gr
2
+ from gradio_client import Client, handle_file
3
 
4
  def get_speech(text, voice):
5
+
6
+ client = Client("collabora/WhisperSpeech")
7
  result = client.predict(
8
+ multilingual_text=text,
9
+ speaker_audio=voice,
10
+ speaker_url="",
11
+ cps=14,
12
+ api_name="/whisper_speech_demo"
13
  )
14
  print(result)
15
+
16
  return result
17
 
18
  def get_dreamtalk(image_in, speech):
19
+ client = Client("fffiloni/dreamtalk")
20
  result = client.predict(
21
+ audio_input=handle_file(speech),
22
+ image_path=handle_file(image_in),
23
+ emotional_style="M030_front_neutral_level1_001.mat",
24
+ api_name="/infer"
25
  )
26
  print(result)
27
  return result['video']