| import gradio as gr |
|
|
| |
| |
| VIDEO_DATABASE = { |
| "Multi-Head Attention": { |
| "url": "./papers-context/transformer-paper/MultiHeadAttentionScene_3.mp4", |
| "context": "Topic: Multi-Head Attention: Diverse Perspectives for Enhanced Context" |
| }, |
| "Scaled Dot-Product Attention": { |
| "url": "./papers-context/transformer-paper/Scaled_Dot-Product_Attention_The_Mathematical_Core_2.mp4", |
| "context": "Topic: Scaled Dot-Product Attention: The Core of Contextual Understanding" |
| }, |
| "Residual Connections": { |
| "url": "./papers-context/deepseek_mhc_renders/deepseek_mhc_animation_0.mp4", |
| "context": "Topic: Residual Connections: The Foundation for Deep Networks, and Hyper-Connections (HC)" |
| }, |
| "Unveiling the Pitfalls": { |
| "url": "./papers-context/deepseek_mhc_renders/deepseek_mhc_animation_1.mp4", |
| "context": "Topic: Unveiling the Pitfalls: Hyper-Connections' Instability and Memory Demands" |
| }, |
| "mHC": { |
| "url": "./papers-context/deepseek_mhc_renders/deepseek_mhc_animation_2.mp4", |
| "context": "mHC: The Manifold Approach to Stable Hyper-Connections" |
| }, |
| "Projecting to Stability": { |
| "url": "./papers-context/deepseek_mhc_renders/deepseek_mhc_animation_3.mp4", |
| "context": "Topic: Projecting to Stability: Parameterizing mHC with Sinkhorn-Knopp" |
| }, |
| } |
|
|
| |
| video_titles = list(VIDEO_DATABASE.keys()) |
|
|
| def load_video_data(selected_title): |
| """ |
| Triggered when the user changes the dropdown selection. |
| Fetches the corresponding URL and context from the dictionary. |
| """ |
| if not selected_title: |
| return None, "" |
| |
| |
| data = VIDEO_DATABASE[selected_title] |
| return data["url"], data["context"] |
|
|
| def process_displayed_data(video_path, context): |
| """ |
| Simulates your backend analysis on whatever is currently on the screen. |
| """ |
| if not video_path: |
| return "β οΈ Please select a video from the dropdown first." |
| |
| return ( |
| f"β
Successfully processed the current video!\n\n" |
| f"π URL: {video_path}\n" |
| f"π Context snippet: {context[:40]}..." |
| ) |
|
|
| |
| with gr.Blocks(theme=gr.themes.Soft()) as demo: |
| gr.Markdown("# π₯ Video Database Viewer") |
| gr.Markdown("Select a video from the dropdown to load its content and context.") |
| |
| |
| |
| video_selector = gr.Dropdown( |
| choices=video_titles, |
| value=video_titles[0], |
| label="Select a Video to Load", |
| interactive=True |
| ) |
| |
| gr.Markdown("---") |
| |
| with gr.Row(): |
| |
| with gr.Column(): |
| video_display = gr.Video( |
| label="Current Video", |
| interactive=False |
| ) |
| |
| |
| with gr.Column(): |
| context_display = gr.Textbox( |
| label="Associated Context", |
| lines=6, |
| interactive=False |
| ) |
| |
| |
|
|
| |
| |
| |
| video_selector.change( |
| fn=load_video_data, |
| inputs=[video_selector], |
| outputs=[video_display, context_display] |
| ) |
| |
| |
| demo.load( |
| fn=load_video_data, |
| inputs=[video_selector], |
| outputs=[video_display, context_display] |
| ) |
|
|
| |
|
|
| if __name__ == "__main__": |
| demo.launch(debug=True) |