File size: 8,818 Bytes
343bf49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Course Page - SmartLearn</title>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <link rel="stylesheet" href="{{ url_for('static', filename='student_course.css') }}">
</head>
<body>
    <style> 

        .logo {

            font-size: 28px;

            font-weight: 700;

            color: #fff;

            text-shadow: 2px 2px 4px rgba(0,0,0,0.1);

            display: flex;

            align-items: center;

        }

    

        .logo img {

            height: 40px;

            margin-right: 10px;

        }

    

    

        .nav-bar {

                background-color: #fff;

                padding: 10px 0;

                box-shadow: 0 2px 5px rgba(0,0,0,0.1);

            }

    

            .nav-bar ul {

                list-style-type: none;

                margin: 0;

                padding: 0;

                display: flex;

                justify-content: center;

                align-items: center;

            }

    

            .nav-bar li {

                margin: 0 15px;

            }

    

            .nav-bar a {

                text-decoration: none;

                color: var(--text-color);

                font-weight: 600;

                transition: all 0.3s ease;

                display: flex;

                align-items: center;

            }

    

            .nav-bar a img {

                height: 24px;

                margin-right: 5px;

            }

            body {

            font-family: Arial, sans-serif;

            line-height: 1.6;

            margin: 0;

            padding: 20px;

            background-color: #f4f4f4;

        }

        .container {

            max-width: 800px;

            margin: auto;

            background: white;

            padding: 20px;

            border-radius: 5px;

            box-shadow: 0 0 10px rgba(0,0,0,0.1);

        }

        h1 {

            color: #333;

            text-align: center;

        }

        #linkInput {

            width: 100%;

            padding: 10px;

            margin-bottom: 10px;

            border: 1px solid #ddd;

            border-radius: 4px;

        }

        #summarizeBtn {

            display: block;

            width: 100%;

            padding: 10px;

            background-color: #4CAF50;

            color: white;

            border: none;

            border-radius: 4px;

            cursor: pointer;

        }

        #summarizeBtn:hover {

            background-color: #45a049;

        }

        #summary {

            margin-top: 20px;

            padding: 15px;

            background-color: #e7f3fe;

            border-left: 6px solid #2196F3;

        }

        #loading {

            text-align: center;

            display: none;

        }

        </style>
    
    <header>
        <div class="">
            <div class="header-content">
                <div class="logo"><img src="../static/smart-learn.jpeg" alt="">SmartLearn</div>
                <div class="search-bar">
                    <input type="text" placeholder="Search for anything">
                    <div class="ai-tools">
                        <i class="fas fa-camera" title="Photo Question Answering"></i>
                        <i class="fas fa-brain" title="AI Tutor"></i>
                        <i class="fas fa-robot" title="AI Assistant"></i>
                    </div>
                </div>
                <div class="user-actions">
                    <span class="points-display">1500 pts</span>
                    <div class="profile-icon">A</div>
                </div>
            </div>
        </div>
    </header>
    <nav class="nav-bar">
        <ul>
            <li><a href="{{ url_for('student') }}"><img src="https://cdn-icons-png.flaticon.com/512/1946/1946488.png" alt="Home">Home</a></li>
            <li><a href="{{ url_for('student') }}#ai-powered-tools"><img src="https://www.kalupurbank.com/wp-content/uploads/2023/02/robot-chatbot-icon-sign-free-vector.webp" alt="Home">Ai Tools</a></li>
            <li><a href="{{ url_for('homework') }}"><img src="https://cdn-icons-png.flaticon.com/512/1828/1828919.png" alt="Homework">Homework</a></li>
            <li><a href="{{ url_for('student_courses') }}"><img src="https://cdn-icons-png.flaticon.com/512/1048/1048953.png" alt="Courses">Courses</a></li>
            <li><a href="{{ url_for('speak') }}"><img src="https://cdn-icons-png.flaticon.com/512/4712/4712026.png" alt="Speak With AI">Speak With AI</a></li>
            <li><a href="{{ url_for('summarise_video') }}"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/09/YouTube_full-color_icon_%282017%29.svg/1280px-YouTube_full-color_icon_%282017%29.svg.png" alt="Ssummarise_video">summarise_video</a></li>
        </ul>
    </nav>
        
</head>
<body>
    <div class="container">
        <h1>YouTube Video Summarizer</h1>
        <input type="text" id="linkInput" placeholder="Paste YouTube video link here">
        <button id="summarizeBtn">Summarize Video</button>
        <div id="loading">Summarizing... Please wait.</div>
        <div id="summary"></div>
    </div>

    <script>

        document.getElementById('summarizeBtn').addEventListener('click', function() {

            var link = document.getElementById('linkInput').value;

            var summaryDiv = document.getElementById('summary');

            var loadingDiv = document.getElementById('loading');



            if (link) {

                // Show loading message

                loadingDiv.style.display = 'block';

                summaryDiv.innerHTML = '';



                // Here you would typically send the link to your backend for processing

                // For this example, we'll simulate a delay and then show a mock summary

                setTimeout(function() {

                    loadingDiv.style.display = 'none';

                    summaryDiv.innerHTML = '<h3>Summary:</h3><p>This is where the summary of the YouTube video would appear. Your model would process the video and generate a summary based on its content.</p>';

                }, 2000); // Simulating a 2-second delay



                // In a real application, you would replace the above with an actual API call:

                /*

                fetch('/api/summarize', {

                    method: 'POST',

                    headers: {

                        'Content-Type': 'application/json',

                    },

                    body: JSON.stringify({link: link}),

                })

                .then(response => response.json())

                .then(data => {

                    loadingDiv.style.display = 'none';

                    summaryDiv.innerHTML = '<h3>Summary:</h3><p>' + data.summary + '</p>';

                })

                .catch((error) => {

                    loadingDiv.style.display = 'none';

                    summaryDiv.innerHTML = '<p>Error: Unable to summarize video. Please try again.</p>';

                });

                */

            } else {

                summaryDiv.innerHTML = '<p>Please enter a valid YouTube link.</p>';

            }

        });

    </script>
    <script>

    document.getElementById('summarizeBtn').addEventListener('click', function() {

        var link = document.getElementById('linkInput').value;

        var summaryDiv = document.getElementById('summary');

        var loadingDiv = document.getElementById('loading');



        if (link) {

            loadingDiv.style.display = 'block';

            summaryDiv.innerHTML = '';



            fetch('/summarize_video', {

                method: 'POST',

                headers: {

                    'Content-Type': 'application/json',

                },

                body: JSON.stringify({url: link}),

            })

            .then(response => response.json())

            .then(data => {

                loadingDiv.style.display = 'none';



                    summaryDiv.innerHTML = '<h3>Summary:</h3><p>' + data.summary + '</p>';   





            })

            .catch((error) => {

                loadingDiv.style.display = 'none';

                summaryDiv.innerHTML = '<p>Error: Unable to summarize video. Please try again.</p>';

            });

        } else {

            summaryDiv.innerHTML = '<p>Please enter a valid YouTube link.</p>';

        }

    });

</script>
</body>
</html>