Skip to content

Instantly share code, notes, and snippets.

View gaurav22verma's full-sized avatar

Gaurav Verma gaurav22verma

View GitHub Profile
@gaurav22verma
gaurav22verma / gemini_api.py
Created February 9, 2024 16:07
Google's Gemini API
# Prelims: you can read about Google's AI APIs here: https://cloud.google.com/vertex-ai/docs/generative-ai/multimodal/overview
# Choose your model and mention it in line # 27
# You will also need to setup GCloud to get the project ID. Instructions here: https://cloud.google.com/vertex-ai/docs/start/cloud-environment
import os
import base64
import time
import random
import sys
@gaurav22verma
gaurav22verma / downloadImagesFromURL.py
Created April 7, 2019 12:18
Python script to download images; given their URL as input
import urllib2
from bs4 import BeautifulSoup
filename = 'CSVFile_images.csv'
fileInput = open(filename, 'r')
lines = fileInput.readlines()
fileInput.close()
failedURLFile = open('failedURLFile.txt', 'a')
@gaurav22verma
gaurav22verma / downloadSongFromURL.py
Created April 7, 2019 11:37
A sample Python script to download audio from YouTube URL
import pafy
import time
sample_URLs = ['wdPAIXBmcF0', 'FiiA9OSm5lc']
for an_elt in sample_URLs:
URL = an_elt.strip()
try:
video = pafy.new(URL)
# Check that the duration of the video is less than 10 minutes