annapurnapadmaprema-ji
commited on
Commit
•
38efc0b
1
Parent(s):
795cfe8
Update app.py
Browse files
app.py
CHANGED
@@ -41,6 +41,64 @@ def save_audio_to_bytes(samples: torch.Tensor):
|
|
41 |
audio_buffer.seek(0) # Move to the start of the buffer
|
42 |
return audio_buffer
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
st.set_page_config(
|
45 |
page_icon=":musical_note:",
|
46 |
page_title="Music Gen"
|
|
|
41 |
audio_buffer.seek(0) # Move to the start of the buffer
|
42 |
return audio_buffer
|
43 |
|
44 |
+
video_background = """
|
45 |
+
<style>
|
46 |
+
.video-container {
|
47 |
+
position: fixed;
|
48 |
+
top: 0;
|
49 |
+
left: 0;
|
50 |
+
width: 100%;
|
51 |
+
height: 100%;
|
52 |
+
overflow: hidden;
|
53 |
+
z-index: -1;
|
54 |
+
}
|
55 |
+
video {
|
56 |
+
position: absolute;
|
57 |
+
top: 50%;
|
58 |
+
left: 50%;
|
59 |
+
min-width: 100%;
|
60 |
+
min-height: 100%;
|
61 |
+
width: auto;
|
62 |
+
height: auto;
|
63 |
+
z-index: -1;
|
64 |
+
transform: translate(-50%, -50%);
|
65 |
+
background-size: cover;
|
66 |
+
}
|
67 |
+
</style>
|
68 |
+
|
69 |
+
<div class="video-container">
|
70 |
+
<video autoplay loop muted>
|
71 |
+
<source src="https://go.screenpal.com/watch/cZX2oynVXxQ" type="video/mp4">
|
72 |
+
</video>
|
73 |
+
</div>
|
74 |
+
"""
|
75 |
+
|
76 |
+
st.markdown(video_background, unsafe_allow_html=True)
|
77 |
+
|
78 |
+
# Set up Streamlit app content
|
79 |
+
st.set_page_config(
|
80 |
+
page_icon=":musical_note:",
|
81 |
+
page_title="Music Gen"
|
82 |
+
)
|
83 |
+
|
84 |
+
def main():
|
85 |
+
st.title("Your Music")
|
86 |
+
|
87 |
+
with st.expander("See Explanation"):
|
88 |
+
st.write("This app uses Meta's Audiocraft Music Gen model to generate audio based on your description.")
|
89 |
+
|
90 |
+
text_area = st.text_area("Enter description")
|
91 |
+
time_slider = st.slider("Select time duration (seconds)", 2, 20, 5)
|
92 |
+
|
93 |
+
if text_area and time_slider:
|
94 |
+
st.json(
|
95 |
+
{
|
96 |
+
"Description": text_area,
|
97 |
+
"Selected duration": time_slider
|
98 |
+
}
|
99 |
+
)
|
100 |
+
st.write("Generating your music... please wait.")
|
101 |
+
|
102 |
st.set_page_config(
|
103 |
page_icon=":musical_note:",
|
104 |
page_title="Music Gen"
|