Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -80,11 +80,6 @@ def text_to_sentiment(text):
|
|
| 80 |
sentiment = classifier(text)[0]["label"]
|
| 81 |
return sentiment
|
| 82 |
|
| 83 |
-
#TTStory
|
| 84 |
-
def text_to_story(text):
|
| 85 |
-
story= story_gen(text)[0]["label"]
|
| 86 |
-
return story
|
| 87 |
-
|
| 88 |
#Save
|
| 89 |
def upsert(text):
|
| 90 |
date_time =str(datetime.datetime.today())
|
|
@@ -122,13 +117,6 @@ def tts(text: str, model_name: str):
|
|
| 122 |
synthesizer.save_wav(wavs, fp)
|
| 123 |
return fp.name
|
| 124 |
|
| 125 |
-
#TTStory
|
| 126 |
-
def ttstory(text: str, model_name: str):
|
| 127 |
-
print(text, model_name)
|
| 128 |
-
gen = GENERATORS.get(model_name, None)
|
| 129 |
-
if gen is None:
|
| 130 |
-
raise NameError("model not found")
|
| 131 |
-
|
| 132 |
|
| 133 |
#Blocks Rock It
|
| 134 |
demo = gr.Blocks()
|
|
@@ -140,7 +128,6 @@ with demo:
|
|
| 140 |
saved = gr.Textbox()
|
| 141 |
savedAll = gr.Textbox()
|
| 142 |
TTSchoice = gr.inputs.Radio( label="Pick a TTS Model", choices=MODEL_NAMES, )
|
| 143 |
-
Storychoice = gr.inputs.Radio( label="Pick a Story Generator", choices=GEN_NAMES, )
|
| 144 |
audio = gr.Audio(label="Output", interactive=False)
|
| 145 |
|
| 146 |
|
|
@@ -150,7 +137,6 @@ with demo:
|
|
| 150 |
b3 = gr.Button("Save Speech to Text")
|
| 151 |
b4 = gr.Button("Retrieve All")
|
| 152 |
b5 = gr.Button("Read It Back Aloud")
|
| 153 |
-
b6 = gr.Button("Generate a Story")
|
| 154 |
|
| 155 |
#Event Model Chains
|
| 156 |
b1.click(speech_to_text, inputs=audio_file, outputs=text)
|
|
@@ -158,13 +144,11 @@ with demo:
|
|
| 158 |
b3.click(upsert, inputs=text, outputs=saved)
|
| 159 |
b4.click(selectall, inputs=text, outputs=savedAll)
|
| 160 |
b5.click(tts, inputs=[text,TTSchoice], outputs=audio)
|
| 161 |
-
b6.click(text_to_story, inputs=text, outputs=text)
|
| 162 |
|
| 163 |
# Lets Do It
|
| 164 |
demo.launch(share=True)
|
| 165 |
|
| 166 |
title = "Story Generators"
|
| 167 |
-
|
| 168 |
examples = [
|
| 169 |
["At which point do we invent Love?"],
|
| 170 |
["Love is a capacity more than consciousness is universal."],
|
|
|
|
| 80 |
sentiment = classifier(text)[0]["label"]
|
| 81 |
return sentiment
|
| 82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
#Save
|
| 84 |
def upsert(text):
|
| 85 |
date_time =str(datetime.datetime.today())
|
|
|
|
| 117 |
synthesizer.save_wav(wavs, fp)
|
| 118 |
return fp.name
|
| 119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
|
| 121 |
#Blocks Rock It
|
| 122 |
demo = gr.Blocks()
|
|
|
|
| 128 |
saved = gr.Textbox()
|
| 129 |
savedAll = gr.Textbox()
|
| 130 |
TTSchoice = gr.inputs.Radio( label="Pick a TTS Model", choices=MODEL_NAMES, )
|
|
|
|
| 131 |
audio = gr.Audio(label="Output", interactive=False)
|
| 132 |
|
| 133 |
|
|
|
|
| 137 |
b3 = gr.Button("Save Speech to Text")
|
| 138 |
b4 = gr.Button("Retrieve All")
|
| 139 |
b5 = gr.Button("Read It Back Aloud")
|
|
|
|
| 140 |
|
| 141 |
#Event Model Chains
|
| 142 |
b1.click(speech_to_text, inputs=audio_file, outputs=text)
|
|
|
|
| 144 |
b3.click(upsert, inputs=text, outputs=saved)
|
| 145 |
b4.click(selectall, inputs=text, outputs=savedAll)
|
| 146 |
b5.click(tts, inputs=[text,TTSchoice], outputs=audio)
|
|
|
|
| 147 |
|
| 148 |
# Lets Do It
|
| 149 |
demo.launch(share=True)
|
| 150 |
|
| 151 |
title = "Story Generators"
|
|
|
|
| 152 |
examples = [
|
| 153 |
["At which point do we invent Love?"],
|
| 154 |
["Love is a capacity more than consciousness is universal."],
|