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 tensorflow as tf | |
#load required libraries and functions such as load_model etc | |
model_path = './example.h5' #path to your model | |
tf_model = tf.keras.models.load_model( model_path ) | |
converter = tf.lite.TFLiteConverter.from_keras_model( tf_model ) | |
tf_lite_model = converter.convert() | |
open( 'facenet.tflite' , 'wb' ).write( tf_lite_model ) |
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
#pip install opendatasets | |
#this will download the datasets into the specified folder / Google Drive | |
#pass the kaggle dataset URL string as an argument to od.download() function | |
import opendatasets as od | |
od.download("https://www.kaggle.com/datasets/jangedoo/utkface-new") |
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
''' | |
=> df | |
Location Parameter | |
0 A 10 | |
1 A 20 | |
2 B 14 | |
3 B 16 | |
4 C 15 | |
5 C 9 | |
6 C 6 |
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 necessary libraries | |
# Need to install requests and openai using PIP | |
# Go to your openai page and get your API from there and update below in the code. | |
import openai | |
import requests | |
import os | |
# Set the OpenAI API key | |
openai.api_key = "YOUR_API_KEY" |
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
from sentence_transformers import SentenceTransformer, util | |
import time | |
model = SentenceTransformer("all-MiniLM-L6-v2") | |
# Two lists of sentences | |
sentences1 = [ | |
"I want to know about financial advice about car loan.", | |
] |
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 requests | |
import base64 | |
# https://catalog.ngc.nvidia.com/orgs/nvidia/teams/ai-foundation/models/sdxl/api | |
API_KEY = "GET API KEY FROM NVIDIA PLAYGROUND FROM ABOVE LINK IN COMMENT" | |
invoke_url = "https://api.nvcf.nvidia.com/v2/nvcf/pexec/functions/89848fb8-549f-41bb-88cb-95d6597044a4" | |
fetch_url_format = "https://api.nvcf.nvidia.com/v2/nvcf/pexec/status/" | |
headers = { |