osanseviero HF staff commited on
Commit
9cae43d
1 Parent(s): 56c8767

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -35
app.py CHANGED
@@ -51,19 +51,7 @@ def inference(text, voice):
51
  torchaudio.save('generated.wav', gen.squeeze(0).cpu(), 24000)
52
  return "generated.wav"
53
 
54
- def inference_own_voice(text, voice_1, voice_2, voice_3):
55
- text = text[:256]
56
- print(voice_1, voice_2, voice_3)
57
- conds = [
58
- load_audio(voice_1, 22050),
59
- load_audio(voice_2, 22050),
60
- load_audio(voice_3, 22050),
61
- ]
62
- print(text, conds, preset)
63
- gen = tts.tts_with_preset(text, conds, preset)
64
- print("gen")
65
- torchaudio.save('generated.wav', gen.squeeze(0).cpu(), 24000)
66
- return "generated.wav"
67
 
68
  text = "Joining two modalities results in a surprising increase in generalization! What would happen if we combined them all?"
69
  examples = [
@@ -77,28 +65,21 @@ with block:
77
  gr.Markdown("# TorToiSe")
78
  gr.Markdown("A multi-voice TTS system trained with an emphasis on quality")
79
  with gr.Tabs():
80
- with gr.TabItem("Pre-recorded voices"):
81
- iface = gr.Interface(
82
- inference,
83
- inputs=[
84
- gr.inputs.Textbox(type="str", default=text, label="Text", lines=3),
85
- gr.inputs.Dropdown(voices),
86
- ],
87
- outputs="audio",
88
- examples=examples,
89
- )
90
- with gr.TabItem("Record your voice"):
91
- iface = gr.Interface(
92
- inference_own_voice,
93
- inputs=[
94
- gr.inputs.Textbox(type="str", default=text, label="Text", lines=3),
95
- gr.inputs.Audio(source="microphone", label="Record yourself reading something out loud (audio 1)", type="filepath"),
96
- gr.inputs.Audio(source="microphone", label="Record yourself reading something out loud (audio 2)", type="filepath"),
97
- gr.inputs.Audio(source="microphone", label="Record yourself reading something out loud (audio 3)", type="filepath"),
98
- ],
99
- outputs="audio"
100
- )
101
 
102
  gr.Markdown("This demo shows the ultra fast option in the TorToiSe system. For more info check the <a href='https://github.com/neonbjb/tortoise-tts' target='_blank'>Repository</a>.",)
103
 
104
- block.launch()
 
 
 
 
51
  torchaudio.save('generated.wav', gen.squeeze(0).cpu(), 24000)
52
  return "generated.wav"
53
 
54
+
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  text = "Joining two modalities results in a surprising increase in generalization! What would happen if we combined them all?"
57
  examples = [
 
65
  gr.Markdown("# TorToiSe")
66
  gr.Markdown("A multi-voice TTS system trained with an emphasis on quality")
67
  with gr.Tabs():
68
+ with gr.TabItem("Pre-recorded voices"):
69
+ iface = gr.Interface(
70
+ inference,
71
+ inputs=[
72
+ gr.inputs.Textbox(type="str", default=text, label="Text", lines=3),
73
+ gr.inputs.Dropdown(voices),
74
+ ],
75
+ outputs="audio",
76
+ enable_queue=True,
77
+ examples=examples,
78
+ )
 
 
 
 
 
 
 
 
 
 
79
 
80
  gr.Markdown("This demo shows the ultra fast option in the TorToiSe system. For more info check the <a href='https://github.com/neonbjb/tortoise-tts' target='_blank'>Repository</a>.",)
81
 
82
+ block.launch()
83
+
84
+
85
+ iface.launch(cache_examples=True)