Vlad Bastina commited on
Commit
bbbf822
Β·
1 Parent(s): cc890bb

default changes

Browse files
Files changed (3) hide show
  1. .gitignore +2 -1
  2. app.py +48 -15
  3. meeting.mp4 +3 -0
.gitignore CHANGED
@@ -2,4 +2,5 @@
2
  __pycache__
3
  *.wav
4
  *.json
5
- *.mp4
 
 
2
  __pycache__
3
  *.wav
4
  *.json
5
+ *.mp4
6
+ !meeting.mp4
app.py CHANGED
@@ -10,6 +10,12 @@ def extract_audio(video_path, audio_path):
10
  audio = video.audio
11
  audio.write_audiofile(audio_path, codec="pcm_s16le") # Save as WAV (best for transcription)
12
  video.close()
 
 
 
 
 
 
13
 
14
  if __name__ == "__main__":
15
  google_credentials_json = json.dumps(dict(st.secrets["GOOGLE_APPLICATION_CREDENTIALS"]))
@@ -21,35 +27,62 @@ if __name__ == "__main__":
21
  # Set the environment variable to point to the temporary file
22
  os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = temp_file
23
  st.title("πŸŽ₯ AI-Powered Meeting Report Generator")
24
- st.sidebar.image('zega_logo.PNG',width=300)
25
 
26
  api_key = st.secrets['GOOGLE_API_KEY']
27
 
28
- # File Uploader
29
- uploaded_file = st.file_uploader("Upload a video file (MP4)", type=["mp4"])
 
30
 
31
- if uploaded_file:
32
- # Save uploaded file temporarily
33
- video_path = "temp_video.mp4"
34
- with open(video_path, "wb") as f:
35
- f.write(uploaded_file.read())
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  audio_path = "temp_audio.wav"
38
- extract_audio(video_path,audio_path)
39
-
40
  with st.spinner("Fetching transcript from meeting..."):
41
  meeting_transcript = get_transcription()
42
-
43
- client = VideoProcessingClient(api_key=api_key,model_name='gemini-2.0-pro-exp-02-05')
44
 
45
  with st.spinner("Uploading video..."):
46
  video_file = client.upload_video(video_path)
47
-
48
  with st.spinner("Processing video..."):
49
  client.wait_for_processing()
50
-
51
  with st.spinner("Generating response.."):
52
  response = client.summarize_video(meeting_transcript)
53
 
54
  st.subheader("πŸ“œ Report of the meeting:")
55
- st.write(response)
 
10
  audio = video.audio
11
  audio.write_audiofile(audio_path, codec="pcm_s16le") # Save as WAV (best for transcription)
12
  video.close()
13
+
14
+ st.cache_resource()
15
+ def load_resources():
16
+ client = VideoProcessingClient(api_key=api_key, model_name='gemini-2.0-pro-exp-02-05')
17
+
18
+ return client
19
 
20
  if __name__ == "__main__":
21
  google_credentials_json = json.dumps(dict(st.secrets["GOOGLE_APPLICATION_CREDENTIALS"]))
 
27
  # Set the environment variable to point to the temporary file
28
  os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = temp_file
29
  st.title("πŸŽ₯ AI-Powered Meeting Report Generator")
30
+ st.sidebar.image('zega_logo.PNG', width=300)
31
 
32
  api_key = st.secrets['GOOGLE_API_KEY']
33
 
34
+ client = load_resources()
35
+ # Add a radio button to choose between uploading own video or using the default video
36
+ video_option = st.radio("Choose a video option", ("Upload your own video", "Use default video"))
37
 
38
+ if video_option == "Upload your own video":
39
+ # File Uploader
40
+ uploaded_file = st.file_uploader("Upload a video file (MP4)", type=["mp4"])
 
 
41
 
42
+ if uploaded_file:
43
+
44
+ video_path = "temp_video.mp4"
45
+ with open(video_path, "wb") as f:
46
+ f.write(uploaded_file.read())
47
+
48
+ with open(video_path, "wb") as f:
49
+ f.write(uploaded_file.read())
50
+
51
+ audio_path = "temp_audio.wav"
52
+ extract_audio(video_path, audio_path)
53
+
54
+ with st.spinner("Fetching transcript from meeting..."):
55
+ meeting_transcript = get_transcription()
56
+
57
+ with st.spinner("Uploading video..."):
58
+ video_file = client.upload_video(video_path)
59
+
60
+ with st.spinner("Processing video..."):
61
+ client.wait_for_processing()
62
+
63
+ with st.spinner("Generating response.."):
64
+ response = client.summarize_video(meeting_transcript)
65
+
66
+ st.subheader("πŸ“œ Report of the meeting:")
67
+ st.write(response)
68
+
69
+ elif video_option == "Use default video":
70
+ # Path for default video
71
+ video_path = "meeting.mp4"
72
  audio_path = "temp_audio.wav"
73
+ extract_audio(video_path, audio_path)
74
+
75
  with st.spinner("Fetching transcript from meeting..."):
76
  meeting_transcript = get_transcription()
 
 
77
 
78
  with st.spinner("Uploading video..."):
79
  video_file = client.upload_video(video_path)
80
+
81
  with st.spinner("Processing video..."):
82
  client.wait_for_processing()
83
+
84
  with st.spinner("Generating response.."):
85
  response = client.summarize_video(meeting_transcript)
86
 
87
  st.subheader("πŸ“œ Report of the meeting:")
88
+ st.write(response)
meeting.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b20463eee9726ca331b4707e8ca88244697bea6d91e3c781fe8c95d1883bbcc8
3
+ size 63751169