Spaces:
Runtime error
Runtime error
arjunanand13
commited on
Commit
•
9936e49
1
Parent(s):
868be79
Update app.py
Browse files
app.py
CHANGED
@@ -440,42 +440,41 @@ class VideoClassifier:
|
|
440 |
|
441 |
return "Model selected: " + model_name
|
442 |
|
443 |
-
def launch_interface(
|
444 |
css_code = """
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
"""
|
465 |
-
|
466 |
# First interface for model selection
|
467 |
interface_1 = gr.Interface(
|
468 |
-
|
469 |
inputs=gr.Dropdown(
|
470 |
choices=['gemini', 'mistral'],
|
471 |
label="Select Model",
|
472 |
-
info="Default model: Gemini"
|
473 |
),
|
474 |
outputs="text",
|
475 |
-
# css=css_code,
|
476 |
title="Model Selection",
|
477 |
)
|
478 |
-
|
479 |
# Second interface for video classification
|
480 |
video_examples = [
|
481 |
[os.path.join(os.path.dirname(__file__), "American_football_heads_to_India_clip.mp4")],
|
@@ -484,29 +483,30 @@ class VideoClassifier:
|
|
484 |
[os.path.dirname(__file__) + "/Spirituality_1_clip.mp4"],
|
485 |
[os.path.dirname(__file__) + "/Science_clip.mp4"],
|
486 |
]
|
487 |
-
|
488 |
checkbox = gr.CheckboxGroup(
|
489 |
["Image Captions and Audio for Classification"],
|
490 |
label="Features",
|
491 |
-
info="default
|
492 |
)
|
493 |
-
|
494 |
-
|
495 |
-
fn=
|
496 |
-
inputs=[
|
497 |
-
outputs=
|
498 |
examples=video_examples,
|
|
|
499 |
css=css_code,
|
500 |
-
allow_flagging='never',
|
501 |
-
title="Interactive Advertising Bureau (IAB) compliant Video-Ad classification",
|
502 |
)
|
503 |
-
|
504 |
-
#
|
505 |
gr.TabbedInterface(
|
506 |
-
[
|
507 |
["Model Selection", "Video Classification"],
|
508 |
css=css_code,
|
509 |
).launch(debug=True, share=True)
|
|
|
|
|
510 |
|
511 |
# css_code = """
|
512 |
# .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;}
|
|
|
440 |
|
441 |
return "Model selected: " + model_name
|
442 |
|
443 |
+
def launch_interface():
|
444 |
css_code = """
|
445 |
+
.gradio-container {
|
446 |
+
background-color: #d6cbd6;
|
447 |
+
}
|
448 |
+
|
449 |
+
/* Button styling for all buttons */
|
450 |
+
button {
|
451 |
+
background-color: #d6cbd6; /* Default color for all other buttons */
|
452 |
+
color: black;
|
453 |
+
border: 1px solid black;
|
454 |
+
padding: 10px;
|
455 |
+
margin-right: 10px;
|
456 |
+
font-size: 16px; /* Increase font size */
|
457 |
+
font-weight: bold; /* Make text bold */
|
458 |
+
}
|
459 |
+
|
460 |
+
/* Style for the second button */
|
461 |
+
button:nth-child(2) {
|
462 |
+
background-color: #927fc7; /* Custom color for the second button */
|
463 |
+
}
|
464 |
"""
|
465 |
+
|
466 |
# First interface for model selection
|
467 |
interface_1 = gr.Interface(
|
468 |
+
fn=save_model_choice,
|
469 |
inputs=gr.Dropdown(
|
470 |
choices=['gemini', 'mistral'],
|
471 |
label="Select Model",
|
472 |
+
info="Default model: Gemini",
|
473 |
),
|
474 |
outputs="text",
|
|
|
475 |
title="Model Selection",
|
476 |
)
|
477 |
+
|
478 |
# Second interface for video classification
|
479 |
video_examples = [
|
480 |
[os.path.join(os.path.dirname(__file__), "American_football_heads_to_India_clip.mp4")],
|
|
|
483 |
[os.path.dirname(__file__) + "/Spirituality_1_clip.mp4"],
|
484 |
[os.path.dirname(__file__) + "/Science_clip.mp4"],
|
485 |
]
|
486 |
+
|
487 |
checkbox = gr.CheckboxGroup(
|
488 |
["Image Captions and Audio for Classification"],
|
489 |
label="Features",
|
490 |
+
info="default: Audio for classification",
|
491 |
)
|
492 |
+
|
493 |
+
interface_2 = gr.Interface(
|
494 |
+
fn=classify_video,
|
495 |
+
inputs=[gr.PlayableVideo(), checkbox],
|
496 |
+
outputs="text",
|
497 |
examples=video_examples,
|
498 |
+
title="Video Classification",
|
499 |
css=css_code,
|
|
|
|
|
500 |
)
|
501 |
+
|
502 |
+
# Create a tabbed interface
|
503 |
gr.TabbedInterface(
|
504 |
+
[interface_1, interface_2],
|
505 |
["Model Selection", "Video Classification"],
|
506 |
css=css_code,
|
507 |
).launch(debug=True, share=True)
|
508 |
+
|
509 |
+
launch_interface()
|
510 |
|
511 |
# css_code = """
|
512 |
# .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;}
|