Skip to content

Commit 10fcc3e

Browse files
committed
Fetch all the contributors and added a scroll bar for the div
1 parent 375477a commit 10fcc3e

File tree

4 files changed

+69
-35
lines changed

4 files changed

+69
-35
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
1-
More details about project
1+
# **Bird Species Classification** 🐦
22

3+
### 🎯 Goal
4+
The primary goal of this project is to build deep learning models to classify Bird species .
5+
6+
### 🧵 Dataset : https://www.kaggle.com/datasets/akash2907/bird-species-classification/data
7+
8+
### 🧾 Description
9+
This dataset consists of over 170 labeled images of birds, including validation images. Each image belongs to only one bird category. The challenge is to develop models that can accurately classify these images into the correct species.
10+
11+
### 📚 Libraries Needed
12+
- os - Provides functions to interact with the operating system.
13+
- shutil - Offers file operations like copying, moving, and removing files.
14+
- time - Used for time-related functions.
15+
- torch - Core library for PyTorch, used for deep learning.
16+
- torch.nn - Contains neural network layers and loss functions.
17+
- torchvision - Provides datasets, models, and image transformation tools for computer vision.
18+
- torchvision.transforms - Contains common image transformation operations.
19+
- torch.optim - Optimizers for training neural networks.
20+
- matplotlib.pyplot - Used for data visualization, like plotting graphs.
21+
22+
## EDA Result 👉 [Classified Bird Species](https://github.com/Archi20876/machine-learning-repos/blob/main/Classification%20Models/Bird%20species%20classification/bird-species-classification.ipynb)
23+
24+
25+

Website/css/styles.css

+11
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,19 @@ button#toggle-languages:hover {
688688
justify-content: center;
689689
padding: 20px; /* Padding around the grid */
690690
background: linear-gradient(135deg, #121245, #121245); /* Subtle gradient background */
691+
height: 600px; /* Fixed height for the grid */
692+
overflow-y: auto; /* Enable vertical scrolling */
691693
animation: slideInRight 1s ease-in-out;
692694
}
695+
#contributors-grid::-webkit-scrollbar {
696+
width: 10px;
697+
}
698+
699+
#contributors-grid::-webkit-scrollbar-thumb {
700+
background-color:#d60311;
701+
border-radius: 10px;
702+
}
703+
693704

694705
/* Styling for individual contributor div */
695706
.contributor {

Website/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ <h3>Join the Community</h3>
387387

388388
<section id="contributors">
389389
<h1 class="contri-heading">Our Contributors</h1>
390-
<div id="contributors-grid" class="contributors-grid">
390+
<div id="contributors-grid" class="contributors-grid" style="overflow-y: scroll;">
391391
<!-- Contributors will be loaded here by JavaScript -->
392392
</div>
393393
</section>

Website/js/script.js

+33-33
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,7 @@ document.addEventListener('DOMContentLoaded', function() {
280280
sendButton.click();
281281
}
282282
});
283-
284-
// Get the button
285283
const scrollTopBtn = document.getElementById("scroll-top-btn");
286-
287-
// Show the button when the user scrolls down 100px from the top of the document
288284
window.onscroll = function() {
289285
if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
290286
scrollTopBtn.style.display = "block";
@@ -293,7 +289,6 @@ document.addEventListener('DOMContentLoaded', function() {
293289
}
294290
};
295291

296-
// When the user clicks the button, scroll to the top of the document
297292
scrollTopBtn.addEventListener("click", function() {
298293
window.scrollTo({ top: 0, behavior: 'smooth' });
299294
});
@@ -307,48 +302,58 @@ document.addEventListener('DOMContentLoaded', function() {
307302
document.addEventListener("DOMContentLoaded", function() {
308303
fetchContributors();
309304

310-
function fetchContributors() {
311-
const repoOwner = 'recodehive'; // Replace with your repository owner
312-
const repoName = 'machine-learning-repos'; // Replace with your repository name
313-
const apiUrl = `https://api.github.com/repos/${repoOwner}/${repoName}/contributors`;
305+
function fetchContributors(page = 1, allContributors = []) {
306+
const repoOwner = 'recodehive';
307+
const repoName = 'machine-learning-repos';
308+
const apiUrl = `https://api.github.com/repos/${repoOwner}/${repoName}/contributors?per_page=100&page=${page}`;
314309

315310
fetch(apiUrl)
316311
.then(response => response.json())
317312
.then(contributors => {
318-
const contributorsGrid = document.getElementById('contributors-grid');
313+
if (contributors.length > 0) {
314+
allContributors = allContributors.concat(contributors);
319315

320-
contributors.forEach(contributor => {
321-
const contributorDiv = document.createElement('div');
322-
contributorDiv.className = 'contributor';
323-
324-
contributorDiv.innerHTML = `
325-
<img src="${contributor.avatar_url}" alt="${contributor.login}" class="contributor-image">
326-
<div class="contributor-info">
327-
<a href="${contributor.html_url}" target="_blank" class="contributor-name">${contributor.login}</a>
328-
</div>
329-
`;
330-
331-
contributorsGrid.appendChild(contributorDiv);
332-
});
316+
if (contributors.length === 100) {
317+
fetchContributors(page + 1, allContributors);
318+
} else {
319+
displayContributors(allContributors);
320+
}
321+
} else if (allContributors.length > 0) {
322+
displayContributors(allContributors);
323+
}
333324
})
334325
.catch(error => {
335326
console.error('Error fetching contributors:', error);
336327
});
337328
}
329+
330+
function displayContributors(contributors) {
331+
const contributorsGrid = document.getElementById('contributors-grid');
332+
contributorsGrid.innerHTML = '';
333+
contributors.forEach(contributor => {
334+
const contributorDiv = document.createElement('div');
335+
contributorDiv.className = 'contributor';
336+
337+
contributorDiv.innerHTML = `
338+
<img src="${contributor.avatar_url}" alt="${contributor.login}" class="contributor-image">
339+
<div class="contributor-info">
340+
<a href="${contributor.html_url}" target="_blank" class="contributor-name">${contributor.login}</a>
341+
</div>
342+
`;
343+
344+
contributorsGrid.appendChild(contributorDiv);
345+
});
346+
}
338347
});
339348

340349
const toggleDarkModeButton = document.getElementById('toggle-dark-mode');
341350
const body = document.body;
342351

343-
// function to apply the theme based on the stored value
344352
function applyTheme(theme) {
345-
// Remove all theme classes
346353
body.classList.remove('light-mode', 'dark-mode', 'blue-mode');
347354

348-
// Apply the new theme class
349355
body.classList.add(theme);
350356

351-
// Update the icon based on the theme
352357
const icon = toggleDarkModeButton.querySelector('i');
353358
if (theme === 'dark-mode') {
354359
icon.classList.add('fa-adjust');
@@ -360,17 +365,12 @@ document.addEventListener('DOMContentLoaded', function() {
360365
icon.classList.add('fa-moon');
361366
icon.classList.remove('fa-sun', 'fa-adjust');
362367
}
363-
364-
// Save the current theme in localStorage
365368
localStorage.setItem('theme', theme);
366369
}
367-
368-
// Check for the saved theme in localStorage
369370
const savedTheme = localStorage.getItem('theme');
370371
if (savedTheme) {
371372
applyTheme(savedTheme);
372373
} else {
373-
// Set default theme to light
374374
applyTheme('light-mode');
375375
}
376376

@@ -380,7 +380,7 @@ document.addEventListener('DOMContentLoaded', function() {
380380
'blue': 'blue-mode'
381381
};
382382

383-
let i = 0; // For light-mode
383+
let i = 0;
384384

385385
function toggleTheme() {
386386
i++;

0 commit comments

Comments
 (0)