reab5555 commited on
Commit
a3950aa
·
verified ·
1 Parent(s): 31ecbda

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -1
app.py CHANGED
@@ -10,7 +10,33 @@ from config import openai_api_key
10
  llm = load_model(openai_api_key)
11
 
12
  def analyze_video(video_path, max_speakers, progress=gr.Progress()):
13
- # ... (keep the existing analyze_video function as is)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  def create_output_components():
16
  with gr.Row() as row:
 
10
  llm = load_model(openai_api_key)
11
 
12
  def analyze_video(video_path, max_speakers, progress=gr.Progress()):
13
+ start_time = time.time()
14
+ if not video_path:
15
+ return {"error": "Please upload a video file."}
16
+
17
+ progress(0, desc="Starting analysis...")
18
+ progress(0.2, desc="Starting transcription and diarization")
19
+ transcription = diarize_audio(video_path, max_speakers)
20
+ print("Transcription:", transcription) # Debug print
21
+ progress(0.5, desc="Transcription and diarization complete.")
22
+
23
+ progress(0.6, desc="Processing transcription")
24
+ results = process_input(transcription, llm)
25
+ progress(0.7, desc="Transcription processing complete.")
26
+
27
+ progress(0.9, desc="Generating charts")
28
+ charts, explanations = create_charts(results)
29
+ progress(1.0, desc="Charts generation complete.")
30
+
31
+ end_time = time.time()
32
+ execution_time = end_time - start_time
33
+
34
+ return {
35
+ "transcript": transcription,
36
+ "charts": charts,
37
+ "explanations": explanations,
38
+ "execution_time": int(execution_time)
39
+ }
40
 
41
  def create_output_components():
42
  with gr.Row() as row: