ombhojane commited on
Commit
96fe8c7
·
verified ·
1 Parent(s): 46b86ce

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -0
app.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from colab import AIDancePartner
3
+ import tempfile
4
+ import os
5
+
6
+ def main():
7
+ st.title("AI Dance Partner")
8
+ st.write("Upload your dance video and get an AI dance partner!")
9
+
10
+ # Video upload
11
+ uploaded_file = st.file_uploader("Choose a video file", type=['mp4', 'avi', 'mov'])
12
+
13
+ if uploaded_file is not None:
14
+ # Save uploaded file temporarily
15
+ tfile = tempfile.NamedTemporaryFile(delete=False)
16
+ tfile.write(uploaded_file.read())
17
+
18
+ # Dance style selection
19
+ style = st.selectbox(
20
+ "Choose dance partner style",
21
+ ["Sync Partner", "Creative Partner"]
22
+ )
23
+
24
+ if st.button("Generate Dance Partner"):
25
+ with st.spinner("Processing your dance video..."):
26
+ # Process video
27
+ dance_partner = AIDancePartner()
28
+ output_path = dance_partner.process_video(tfile.name, mode=style)
29
+
30
+ # Display result
31
+ st.video(output_path)
32
+
33
+ # Download button
34
+ with open(output_path, 'rb') as file:
35
+ st.download_button(
36
+ label="Download video",
37
+ data=file,
38
+ file_name="ai_dance_partner.mp4",
39
+ mime="video/mp4"
40
+ )
41
+
42
+ # Cleanup
43
+ os.unlink(tfile.name)
44
+
45
+ if __name__ == "__main__":
46
+ main()