Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,15 +12,6 @@ background-attachment: local;
|
|
| 12 |
[data-testid="stHeader"] {{
|
| 13 |
background: rgba(0,0,0,0);
|
| 14 |
}}
|
| 15 |
-
[data-testid="stSidebar"] > div:first-child {{
|
| 16 |
-
background-color: rgba(255, 255, 255, 0.5);
|
| 17 |
-
border-radius: 10px;
|
| 18 |
-
padding: 10px;
|
| 19 |
-
}}
|
| 20 |
-
[data-testid="stSidebar"] > div {{
|
| 21 |
-
background-color: rgba(255, 255, 255, 0.8);
|
| 22 |
-
border-radius: 10px;
|
| 23 |
-
}}
|
| 24 |
.stTitle {{
|
| 25 |
color: #ffffff;
|
| 26 |
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
|
|
@@ -39,29 +30,27 @@ audioldm_exmples_original_paths = []
|
|
| 39 |
exmples_prompts = ["wiwi", "pipi", "wifi"]
|
| 40 |
|
| 41 |
st.title('Drums Generation in Different Models')
|
| 42 |
-
st.sidebar.title("Settings")
|
| 43 |
-
|
| 44 |
-
# Sidebar elements
|
| 45 |
-
st.sidebar.selectbox('How would you like to be contacted?', ('Email', 'Home phone', 'Mobile phone'))
|
| 46 |
-
st.sidebar.slider('Select a range of values', 0.0, 100.0, (25.0, 75.0))
|
| 47 |
|
| 48 |
st.subheader('Upload your audio file to process with AudioLDM2 or StableAudio')
|
| 49 |
|
| 50 |
uploaded_file = st.file_uploader("Choose an audio file", type=["wav", "mp3", "ogg"])
|
| 51 |
model_choice = st.selectbox('Choose a model for processing', ('AudioLDM2', 'StableAudio'))
|
| 52 |
prompt_text = st.text_input('Enter a prompt for the audio processing')
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
if uploaded_file is not None and prompt_text:
|
| 55 |
st.audio(uploaded_file, format="audio/mpeg")
|
| 56 |
|
| 57 |
# Dummy processing function to demonstrate functionality
|
| 58 |
-
def process_audio(file, model, prompt):
|
| 59 |
# Replace this with actual audio processing code
|
| 60 |
processed_audio_path = "processed_audio.wav"
|
| 61 |
return processed_audio_path
|
| 62 |
|
| 63 |
if st.button('Process Audio'):
|
| 64 |
-
processed_audio = process_audio(uploaded_file, model_choice, prompt_text)
|
| 65 |
st.audio(processed_audio, format="audio/mpeg", loop=False)
|
| 66 |
st.download_button(label="Download Processed Audio", data=processed_audio, file_name="processed_audio.wav", mime="audio/wav")
|
| 67 |
|
|
@@ -82,3 +71,15 @@ for p in exmples_prompts:
|
|
| 82 |
for col in audio_columns:
|
| 83 |
col.audio("goodres.wav", format="audio/mpeg", loop=False)
|
| 84 |
st.markdown("<hr style='border: 1px solid #ddd;'>", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
[data-testid="stHeader"] {{
|
| 13 |
background: rgba(0,0,0,0);
|
| 14 |
}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
.stTitle {{
|
| 16 |
color: #ffffff;
|
| 17 |
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
|
|
|
|
| 30 |
exmples_prompts = ["wiwi", "pipi", "wifi"]
|
| 31 |
|
| 32 |
st.title('Drums Generation in Different Models')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
st.subheader('Upload your audio file to process with AudioLDM2 or StableAudio')
|
| 35 |
|
| 36 |
uploaded_file = st.file_uploader("Choose an audio file", type=["wav", "mp3", "ogg"])
|
| 37 |
model_choice = st.selectbox('Choose a model for processing', ('AudioLDM2', 'StableAudio'))
|
| 38 |
prompt_text = st.text_input('Enter a prompt for the audio processing')
|
| 39 |
+
start_point = st.slider('Choose a starting point for the audio (seconds)', 0.0, 60.0, 0.0)
|
| 40 |
+
output_length = st.slider('Choose the length of the output audio (seconds)', 1.0, 60.0, 10.0)
|
| 41 |
+
st.markdown('**Note:** Longer audio takes more time to generate.')
|
| 42 |
|
| 43 |
if uploaded_file is not None and prompt_text:
|
| 44 |
st.audio(uploaded_file, format="audio/mpeg")
|
| 45 |
|
| 46 |
# Dummy processing function to demonstrate functionality
|
| 47 |
+
def process_audio(file, model, prompt, start, length):
|
| 48 |
# Replace this with actual audio processing code
|
| 49 |
processed_audio_path = "processed_audio.wav"
|
| 50 |
return processed_audio_path
|
| 51 |
|
| 52 |
if st.button('Process Audio'):
|
| 53 |
+
processed_audio = process_audio(uploaded_file, model_choice, prompt_text, start_point, output_length)
|
| 54 |
st.audio(processed_audio, format="audio/mpeg", loop=False)
|
| 55 |
st.download_button(label="Download Processed Audio", data=processed_audio, file_name="processed_audio.wav", mime="audio/wav")
|
| 56 |
|
|
|
|
| 71 |
for col in audio_columns:
|
| 72 |
col.audio("goodres.wav", format="audio/mpeg", loop=False)
|
| 73 |
st.markdown("<hr style='border: 1px solid #ddd;'>", unsafe_allow_html=True)
|
| 74 |
+
|
| 75 |
+
# Links Section
|
| 76 |
+
st.markdown("## Useful Links")
|
| 77 |
+
|
| 78 |
+
links = [
|
| 79 |
+
{"url": "https://example.com", "type": "Regular Website", "text": "This is a regular website"},
|
| 80 |
+
{"url": "https://github.com/example", "type": "GitHub", "text": "This is a GitHub repository"},
|
| 81 |
+
{"url": "https://colab.research.google.com", "type": "Google Colab", "text": "This is a Google Colab link"}
|
| 82 |
+
]
|
| 83 |
+
|
| 84 |
+
for link in links:
|
| 85 |
+
st.markdown(f"[{link['text']}]({link['url']}) - *{link['type']}*")
|