Spaces:
Runtime error
Runtime error
Commit
·
dc96563
1
Parent(s):
2c49025
Update app.py
Browse files
app.py
CHANGED
@@ -42,13 +42,14 @@ def text2Speech(story) :
|
|
42 |
|
43 |
def query(payload):
|
44 |
response = requests.post(API_URL, headers=headers, json=payload)
|
|
|
|
|
45 |
return response.json()
|
46 |
|
47 |
output = query({
|
48 |
"inputs": story,
|
49 |
})
|
50 |
-
|
51 |
-
file.write(output)
|
52 |
|
53 |
def main() :
|
54 |
st.header("Turn img into Audio Story")
|
@@ -64,10 +65,9 @@ def main() :
|
|
64 |
with st.expander("scenario"):
|
65 |
st.write(scenario)
|
66 |
story = generate_story(scenario)
|
67 |
-
text2Speech(story)
|
68 |
with st.expander("story"):
|
69 |
st.write(story)
|
70 |
-
|
71 |
st.audio("audio.flac")
|
72 |
|
73 |
|
|
|
42 |
|
43 |
def query(payload):
|
44 |
response = requests.post(API_URL, headers=headers, json=payload)
|
45 |
+
with open('audio.flac','wb') as file:
|
46 |
+
file.write(response.content)
|
47 |
return response.json()
|
48 |
|
49 |
output = query({
|
50 |
"inputs": story,
|
51 |
})
|
52 |
+
|
|
|
53 |
|
54 |
def main() :
|
55 |
st.header("Turn img into Audio Story")
|
|
|
65 |
with st.expander("scenario"):
|
66 |
st.write(scenario)
|
67 |
story = generate_story(scenario)
|
|
|
68 |
with st.expander("story"):
|
69 |
st.write(story)
|
70 |
+
text2Speech(story)
|
71 |
st.audio("audio.flac")
|
72 |
|
73 |
|