This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
def apply_frequency_mask(spectrogram, num_masks=1, mask_width=10): | |
""" | |
Apply frequency masking to the input spectrogram. | |
Parameters: | |
spectrogram (numpy array): 2D array representing the audio spectrogram. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import sounddevice as sd | |
def generate_random_sound(duration=2.0, sample_rate=16000): | |
""" | |
Generate a random sound. | |
Parameters: | |
duration (float): Duration of the sound in seconds. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
import sqlite3 | |
import pyttsx3 | |
# Database setup | |
conn = sqlite3.connect('object_tracking.db') | |
c = conn.cursor() | |
c.execute('''CREATE TABLE IF NOT EXISTS objects | |
(id INTEGER PRIMARY KEY AUTOINCREMENT, rx INTEGER, ry INTEGER, rw INTEGER, rh INTEGER, roi_hist BLOB)''') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
# Create a socket object | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
# Get the local machine name | |
host = socket.gethostname() | |
# Set the port number | |
port = 12345 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from sklearn.model_selection import train_test_split | |
from sklearn.neighbors import KNeighborsClassifier | |
# Load the data for the recommendation system | |
data = pd.read_csv("posts.csv") | |
# Select the relevant columns for the ML model | |
X = data[["hashtags", "time_spent"]] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Question 1 | |
list1 = [] | |
for i in range(20): | |
if i % 2 == 0 or i % 4 == 0: | |
list1.append(i) | |
# Question 2 | |
def square(x): | |
return x ** 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Linked list operations in C | |
#include <stdio.h> | |
#include <stdlib.h> | |
// Create a node | |
struct Node { | |
int data; | |
struct Node* next; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
struct cricket | |
{ | |
char player_name[11]; | |
char team[2]; | |
float bating_avg; | |
} | |
a[50]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int i,num,rem,count; | |
int ar[50]; | |
printf("Enter the number:\n"); | |
scanf("%d",&num); | |
count = 0; | |
i = 0; |
NewerOlder