Pranjal12345 commited on
Commit
d743ee9
·
1 Parent(s): ea84da0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -12
app.py CHANGED
@@ -17,8 +17,8 @@ VOICE_OPTIONS = [
17
  def inference(
18
  text,
19
  voice,
20
- emotion_option,
21
- preset_option,
22
  ):
23
 
24
  texts = [text]
@@ -28,13 +28,13 @@ def inference(
28
  Happy_tone = "[I am so happy]"
29
  Scared_tone = "[I am so scared]"
30
 
31
- if emotion_option == "Angry":
32
  text = Angry_tone + text
33
- if emotion_option == "Sad":
34
  text = Sad_tone + text
35
- if emotion_option == "Happy":
36
  text = Happy_tone + text
37
- if emotion_option == "Scared":
38
  text = Scared_tone + text
39
 
40
  voices = [voice]
@@ -51,7 +51,7 @@ def inference(
51
  text,
52
  voice_samples=voice_samples,
53
  conditioning_latents=conditioning_latents,
54
- preset= preset_option,
55
  k=1
56
  ):
57
  yield (24000, audio_frame.cpu().detach().numpy())
@@ -68,14 +68,13 @@ def main():
68
  VOICE_OPTIONS, value="jane_eyre", label="Select voice:", type="value"
69
  )
70
 
71
- emotion_option = gr.Radio(
72
  ["Angry", "Sad", "Happy", "Scared"],
73
  type="value",
74
  )
75
 
76
- preset_option = gr.Radio(
77
  ["ultra_fast", "fast", "standard", "high_quality"],
78
- label="ultra_fast for quick inference and high_quality for better inference",
79
  type="value",
80
  value="ultra_fast",
81
  )
@@ -86,8 +85,8 @@ def main():
86
  inputs=[
87
  text,
88
  voice,
89
- emotion_option,
90
- preset_option,
91
  ],
92
  title=title,
93
  outputs=[output_audio],
 
17
  def inference(
18
  text,
19
  voice,
20
+ Emotion,
21
+ Preset,
22
  ):
23
 
24
  texts = [text]
 
28
  Happy_tone = "[I am so happy]"
29
  Scared_tone = "[I am so scared]"
30
 
31
+ if Emotion == "Angry":
32
  text = Angry_tone + text
33
+ if Emotion == "Sad":
34
  text = Sad_tone + text
35
+ if Emotion == "Happy":
36
  text = Happy_tone + text
37
+ if Emotion == "Scared":
38
  text = Scared_tone + text
39
 
40
  voices = [voice]
 
51
  text,
52
  voice_samples=voice_samples,
53
  conditioning_latents=conditioning_latents,
54
+ preset= Preset,
55
  k=1
56
  ):
57
  yield (24000, audio_frame.cpu().detach().numpy())
 
68
  VOICE_OPTIONS, value="jane_eyre", label="Select voice:", type="value"
69
  )
70
 
71
+ Emotion = gr.Radio(
72
  ["Angry", "Sad", "Happy", "Scared"],
73
  type="value",
74
  )
75
 
76
+ Preset = gr.Radio(
77
  ["ultra_fast", "fast", "standard", "high_quality"],
 
78
  type="value",
79
  value="ultra_fast",
80
  )
 
85
  inputs=[
86
  text,
87
  voice,
88
+ Emotion,
89
+ Preset,
90
  ],
91
  title=title,
92
  outputs=[output_audio],