ManishThota commited on
Commit
5443ab4
1 Parent(s): 21f9c09

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -23
app.py CHANGED
@@ -2,8 +2,8 @@
2
  import warnings
3
  warnings.filterwarnings("ignore")
4
  import gradio as gr
5
- from src.video_model import describe_video # Your video processing function
6
- from src.text_processor import process_description
7
 
8
  # --- Function to handle both video and text processing ---
9
  def process_video(video, sitting, hands, location, screen):
@@ -12,25 +12,18 @@ def process_video(video, sitting, hands, location, screen):
12
  if sitting:
13
  additional_info.append("Is the subject in the video standing or sitting?")
14
  if hands:
15
- additional_info.append("Is the subject holding any object in their hands, if so the hands are not free else they are free?")
16
  if location:
17
  additional_info.append("Is the subject present indoors or outdoors?")
18
  if screen:
19
  additional_info.append("Is the subject interacting with a screen in the background by facing the screen?")
20
 
21
  final_query = query + " " + " ".join(additional_info)
22
-
23
  video_description = describe_video(video, final_query)
24
-
25
  return video_description
26
 
27
- def process_and_display_json(video_description):
28
- json_response = process_description(video_description)
29
- return json_response
30
-
31
-
32
  # --- Function to handle JSON processing ---
33
- def process_and_display_json(video_description):
34
  json_response = process_description(video_description)
35
  return json_response
36
 
@@ -62,17 +55,17 @@ with gr.Blocks(title="GSoC Super Raid Annotator", theme=gr.themes.Soft(primary_h
62
 
63
  # Examples for the interface
64
  examples = [
65
- ["videos/2016-01-01_0100_US_KNBC_Channel_4_News_1867.16-1871.38_now.mp4",],
66
- ["videos/2016-01-01_0200_US_KNBC_Channel_4_News_1329.12-1333.29_tonight.mp4",],
67
- ["videos/2016-01-01_0830_US_KNBC_Tonight_Show_with_Jimmy_Fallon_725.45-729.76_tonight.mp4",],
68
- ["videos/2016-01-01_0200_US_KOCE_The_PBS_Newshour_577.03-581.31_tonight.mp4"],
69
- ["videos/2016-01-01_1400_US_KTTV-FOX_Morning_News_at_6AM_1842.36-1846.68_this_year.mp4"],
70
- ["videos/2016-01-02_0735_US_KCBS_Late_Show_with_Stephen_Colbert_285.94-290.67_this_year.mp4"],
71
- ["videos/2016-01-13_2200_US_KTTV-FOX_The_Doctor_Oz_Show_1709.79-1714.17_this_month.mp4"],
72
- ["videos/2016-01-01_1400_US_KTTV-FOX_Morning_News_at_6AM_1842.36-1846.68_this_year.mp4"],
73
- ["videos/2016-01-01_1300_US_KNBC_Today_in_LA_at_5am_12.46-16.95_this_morning.mp4"],
74
- ["videos/2016-01-05_0200_US_KNBC_Channel_4_News_1561.29-1565.95_next_week.mp4"],
75
- ["videos/2016-01-28_0700_US_KNBC_Channel_4_News_at_11PM_629.56-633.99_in_the_future.mp4"]
76
  ]
77
 
78
  # Event handling
@@ -89,4 +82,4 @@ with gr.Blocks(title="GSoC Super Raid Annotator", theme=gr.themes.Soft(primary_h
89
  )
90
 
91
  # Launch the interface
92
- demo.launch(debug=False)
 
2
  import warnings
3
  warnings.filterwarnings("ignore")
4
  import gradio as gr
5
+ from src.video_model import describe_video # Ensure this function is defined in src.video_model
6
+ from src.text_processor import process_description # Ensure this function is defined in src.text_processor
7
 
8
  # --- Function to handle both video and text processing ---
9
  def process_video(video, sitting, hands, location, screen):
 
12
  if sitting:
13
  additional_info.append("Is the subject in the video standing or sitting?")
14
  if hands:
15
+ additional_info.append("Is the subject holding any object in their hands, if so, are the hands free?")
16
  if location:
17
  additional_info.append("Is the subject present indoors or outdoors?")
18
  if screen:
19
  additional_info.append("Is the subject interacting with a screen in the background by facing the screen?")
20
 
21
  final_query = query + " " + " ".join(additional_info)
 
22
  video_description = describe_video(video, final_query)
 
23
  return video_description
24
 
 
 
 
 
 
25
  # --- Function to handle JSON processing ---
26
+ def process_and_display_json(video_description):
27
  json_response = process_description(video_description)
28
  return json_response
29
 
 
55
 
56
  # Examples for the interface
57
  examples = [
58
+ ["videos/2016-01-01_0100_US_KNBC_Channel_4_News_1867.16-1871.38_now.mp4"],
59
+ ["videos/2016-01-01_0200_US_KNBC_Channel_4_News_1329.12-1333.29_tonight.mp4"],
60
+ ["videos/2016-01-01_0830_US_KNBC_Tonight_Show_with_Jimmy_Fallon_725.45-729.76_tonight.mp4"],
61
+ ["videos/2016-01-01_0200_US_KOCE_The_PBS_Newshour_577.03-581.31_tonight.mp4"],
62
+ ["videos/2016-01-01_1400_US_KTTV-FOX_Morning_News_at_6AM_1842.36-1846.68_this_year.mp4"],
63
+ ["videos/2016-01-02_0735_US_KCBS_Late_Show_with_Stephen_Colbert_285.94-290.67_this_year.mp4"],
64
+ ["videos/2016-01-13_2200_US_KTTV-FOX_The_Doctor_Oz_Show_1709.79-1714.17_this_month.mp4"],
65
+ ["videos/2016-01-01_1400_US_KTTV-FOX_Morning_News_at_6AM_1842.36-1846.68_this_year.mp4"],
66
+ ["videos/2016-01-01_1300_US_KNBC_Today_in_LA_at_5am_12.46-16.95_this_morning.mp4"],
67
+ ["videos/2016-01-05_0200_US_KNBC_Channel_4_News_1561.29-1565.95_next_week.mp4"],
68
+ ["videos/2016-01-28_0700_US_KNBC_Channel_4_News_at_11PM_629.56-633.99_in_the_future.mp4"]
69
  ]
70
 
71
  # Event handling
 
82
  )
83
 
84
  # Launch the interface
85
+ demo.launch(debug=False)