azeus commited on
Commit
c00ec95
·
1 Parent(s): b6a2312

adding analysis

Browse files
.idea/genre_classify.iml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="inheritedJdk" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ </module>
.idea/inspectionProfiles/profiles_settings.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/genre_classify.iml" filepath="$PROJECT_DIR$/.idea/genre_classify.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
app.py CHANGED
@@ -1,11 +1,54 @@
1
  import streamlit as st
 
2
 
 
3
  st.title("🎵 Music Genre Classifier")
 
4
 
5
- st.write("Basic test to verify app is working")
 
6
 
7
- audio_file = st.file_uploader("Upload an audio file (MP3, WAV)", type=['mp3', 'wav'])
 
 
8
 
9
- if audio_file is not None:
10
- st.audio(audio_file)
11
- st.write("File uploaded successfully!")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ import numpy as np
3
 
4
+ # Page setup
5
  st.title("🎵 Music Genre Classifier")
6
+ st.write("Upload an audio file to analyze its genre")
7
 
8
+ # Create two columns for better layout
9
+ col1, col2 = st.columns(2)
10
 
11
+ with col1:
12
+ # File upload
13
+ audio_file = st.file_uploader("Upload an audio file (MP3, WAV)", type=['mp3', 'wav'])
14
 
15
+ if audio_file is not None:
16
+ # Display audio player
17
+ st.audio(audio_file)
18
+ st.success("File uploaded successfully!")
19
+
20
+ # Add a classify button
21
+ if st.button("Classify Genre"):
22
+ with st.spinner("Analyzing..."):
23
+ # Simulate genre classification (we'll replace this with real model later)
24
+ genres = ["Rock", "Pop", "Hip Hop", "Classical", "Jazz"]
25
+ confidences = np.random.dirichlet(np.ones(5)) # Random probabilities that sum to 1
26
+
27
+ # Show results
28
+ st.write("### Genre Analysis Results:")
29
+ for genre, confidence in zip(genres, confidences):
30
+ st.write(f"{genre}: {confidence:.2%}")
31
+
32
+ # Show top prediction
33
+ top_genre = genres[np.argmax(confidences)]
34
+ st.write(f"**Predicted Genre:** {top_genre}")
35
+
36
+ with col2:
37
+ # Display some tips and information
38
+ st.write("### Tips for best results:")
39
+ st.write("- Upload files in MP3 or WAV format")
40
+ st.write("- Ensure good audio quality")
41
+ st.write("- Try to upload songs without too much background noise")
42
+ st.write("- Ideal length: 10-30 seconds")
43
+
44
+ # Add a sample counter
45
+ if 'analyzed_count' not in st.session_state:
46
+ st.session_state.analyzed_count = 0
47
+
48
+ if audio_file is not None:
49
+ st.session_state.analyzed_count += 1
50
+ st.write(f"Songs analyzed this session: {st.session_state.analyzed_count}")
51
+
52
+ # Footer
53
+ st.markdown("---")
54
+ st.write("Made with ❤️ using Streamlit")
requirements.txt CHANGED
@@ -0,0 +1,2 @@
 
 
 
1
+ streamlit==1.31.0
2
+ numpy==1.24.3