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
# 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 |
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 urllib2 | |
from bs4 import BeautifulSoup | |
filename = 'CSVFile_images.csv' | |
fileInput = open(filename, 'r') | |
lines = fileInput.readlines() | |
fileInput.close() | |
failedURLFile = open('failedURLFile.txt', 'a') |
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 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 |