arjunanand13 commited on
Commit
a94359c
1 Parent(s): 16cdbba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +72 -28
app.py CHANGED
@@ -479,6 +479,50 @@ class VideoClassifier:
479
  text-align: center;
480
  }
481
  """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
482
  # css_code = """
483
  # .gradio-container {background-color: #FFFFFF;color:#000000;background-size: 200px; background-image:url(https://gitlab.ignitarium.in/saran/logo/-/raw/aab7c77b4816b8a4bbdc5588eb57ce8b6c15c72d/ign_logo_white.png);background-repeat:no-repeat; position:relative; top:1px; left:5px; padding: 50px;text-align: right;background-position: right top;}
484
  # """
@@ -493,37 +537,37 @@ class VideoClassifier:
493
  # }
494
  # """
495
 
496
- interface_1 = gr.Interface(
497
- self.save_model_choice,
498
- inputs=gr.Dropdown(choices=['gemini', 'mistral'], label="Select Model", info="Default model: Gemini"),
499
- # outputs=interface_1_output,
500
- outputs="text"
501
 
502
- )
503
-
504
- video_examples = [
505
- [os.path.join(os.path.dirname(__file__), "American_football_heads_to_India_clip.mp4")],
506
- [os.path.join(os.path.dirname(__file__), "PersonalFinance_clip.mp4")],
507
- [os.path.join(os.path.dirname(__file__), "Motorcycle_clip.mp4")],
508
- [os.path.join(os.path.dirname(__file__), "Spirituality_1_clip.mp4")],
509
- [os.path.join(os.path.dirname(__file__), "Science_clip.mp4")]
510
- ]
511
-
512
- # Define the checkbox for additional feature control
513
- checkbox = gr.CheckboxGroup(
514
- ["Image Captions and Audio for Classification"],
515
- label="Features",
516
- info="default : Audio for classification",
517
- )
518
-
519
- default_checkbox = []
520
 
521
- demo = gr.Interface(fn=self.classify_video, inputs=["playablevideo",checkbox],allow_flagging='never', examples=video_examples,
522
- cache_examples=False, outputs=["text"],
523
- css=css_code, title="Interactive Advertising Bureau (IAB) compliant Video-Ad classification")
524
- # demo.launch(debug=True)
525
 
526
- gr.TabbedInterface([interface_1, demo], ["Model Selection", "Video Classification"]).launch(debug=True)
527
 
528
  def run_inference(self, video_path,model):
529
  result = self.classify_video(video_path)
 
479
  text-align: center;
480
  }
481
  """
482
+
483
+ # First interface for model selection
484
+ interface_1 = gr.Interface(
485
+ self.save_model_choice,
486
+ inputs=gr.Dropdown(
487
+ choices=['gemini', 'mistral'],
488
+ label="Select Model",
489
+ info="Default model: Gemini"
490
+ ),
491
+ outputs="text",
492
+ css=css_code,
493
+ title="Model Selection",
494
+ )
495
+
496
+ # Second interface for video classification
497
+ video_examples = [
498
+ [os.path.join(os.path.dirname(__file__), "American_football_heads_to_India_clip.mp4")],
499
+ [os.path.dirname(__file__) + "/PersonalFinance_clip.mp4"],
500
+ [os.path.dirname(__file__) + "/Motorcycle_clip.mp4"],
501
+ [os.path.dirname(__file__) + "/Spirituality_1_clip.mp4"],
502
+ [os.path.dirname(__file__) + "/Science_clip.mp4"],
503
+ ]
504
+
505
+ checkbox = gr.CheckboxGroup(
506
+ ["Image Captions and Audio for Classification"],
507
+ label="Features",
508
+ info="default : Audio for classification",
509
+ )
510
+
511
+ demo = gr.Interface(
512
+ fn=self.classify_video,
513
+ inputs=["playablevideo", checkbox],
514
+ outputs=["text"],
515
+ examples=video_examples,
516
+ css=css_code,
517
+ allow_flagging='never',
518
+ title="Interactive Advertising Bureau (IAB) compliant Video-Ad classification",
519
+ )
520
+
521
+ # Tabbed interface with the custom CSS and highlighting
522
+ gr.TabbedInterface(
523
+ [interface_1, demo], ["Model Selection", "Video Classification"]
524
+ ).launch(debug=True, share=True)
525
+
526
  # css_code = """
527
  # .gradio-container {background-color: #FFFFFF;color:#000000;background-size: 200px; background-image:url(https://gitlab.ignitarium.in/saran/logo/-/raw/aab7c77b4816b8a4bbdc5588eb57ce8b6c15c72d/ign_logo_white.png);background-repeat:no-repeat; position:relative; top:1px; left:5px; padding: 50px;text-align: right;background-position: right top;}
528
  # """
 
537
  # }
538
  # """
539
 
540
+ # interface_1 = gr.Interface(
541
+ # self.save_model_choice,
542
+ # inputs=gr.Dropdown(choices=['gemini', 'mistral'], label="Select Model", info="Default model: Gemini"),
543
+ # # outputs=interface_1_output,
544
+ # outputs="text"
545
 
546
+ # )
547
+
548
+ # video_examples = [
549
+ # [os.path.join(os.path.dirname(__file__), "American_football_heads_to_India_clip.mp4")],
550
+ # [os.path.join(os.path.dirname(__file__), "PersonalFinance_clip.mp4")],
551
+ # [os.path.join(os.path.dirname(__file__), "Motorcycle_clip.mp4")],
552
+ # [os.path.join(os.path.dirname(__file__), "Spirituality_1_clip.mp4")],
553
+ # [os.path.join(os.path.dirname(__file__), "Science_clip.mp4")]
554
+ # ]
555
+
556
+ # # Define the checkbox for additional feature control
557
+ # checkbox = gr.CheckboxGroup(
558
+ # ["Image Captions and Audio for Classification"],
559
+ # label="Features",
560
+ # info="default : Audio for classification",
561
+ # )
562
+
563
+ # default_checkbox = []
564
 
565
+ # demo = gr.Interface(fn=self.classify_video, inputs=["playablevideo",checkbox],allow_flagging='never', examples=video_examples,
566
+ # cache_examples=False, outputs=["text"],
567
+ # css=css_code, title="Interactive Advertising Bureau (IAB) compliant Video-Ad classification")
568
+ # # demo.launch(debug=True)
569
 
570
+ # gr.TabbedInterface([interface_1, demo], ["Model Selection", "Video Classification"]).launch(debug=True)
571
 
572
  def run_inference(self, video_path,model):
573
  result = self.classify_video(video_path)