This file contains hidden or 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
package main | |
import ( | |
"flag" | |
"log" | |
"net/http" | |
"net/url" | |
"strings" | |
"sync" | |
"time" |
This file contains hidden or 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
package main | |
import ( | |
"flag" | |
"log" | |
"net/http" | |
"net/url" | |
"strings" | |
"sync" | |
"time" |
This file contains hidden or 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 fastapi import FastAPI,Depends | |
from .database import engine,SessionLocal,get_db | |
from sqlalchemy.orm import Session | |
import psycopg2 | |
from psycopg2.extras import RealDictCursor | |
app = FastAPI() | |
models.Base.metadata.create_all(bind=engine) |
This file contains hidden or 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
def printbinaryStringsWithoutConsecutive1s(n,i,osf,lastDigit): | |
if i==n: | |
print(osf) | |
return | |
if lastDigit==0: | |
printbinaryStringsWithoutConsecutive1s(n,i+1,osf+'0',0) | |
printbinaryStringsWithoutConsecutive1s(n,i+1,osf+'1',1) | |
else: | |
printbinaryStringsWithoutConsecutive1s(n,i+1,osf+'0',0) | |
printbinaryStringsWithoutConsecutive1s(4,0,'',0) |
This file contains hidden or 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
def printStringSubsets(n,i,osf,char,string): | |
if(i==n): | |
print(f'"{osf}"') | |
return | |
printStringSubsets(n,i+1,osf+originalString[i-1],originalString[i-1],string) | |
printStringSubsets(n,i+1,osf,originalString[i-1],string) | |
originalString = 'xyza' | |
printStringSubsets(len(originalString)+1,1,'',originalString[0],originalString) |
This file contains hidden or 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 JSZip from 'jszip'; | |
import { saveAs } from 'file-saver'; | |
// TODO: Initialize the firebase project in the client side | |
const storage = firebase.storage().ref('<Folder_Name') | |
const getFileUrls = async (dest_storage_path:string) => { | |
const files = await (await storage.listAll()).items | |
const jszip = new JSZip(); |
This file contains hidden or 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
# making the imports ---------------------------------------------------- | |
import os | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from tensorflow.keras.preprocessing.image import ImageDataGenerator | |
from tensorflow.keras.applications.mobilenet_v2 import MobileNetV2, preprocess_input | |
from tensorflow.keras.layers import Dense,Flatten | |
from tensorflow.keras.models import Model, Sequential | |
# import section end ------------------------------------------------------ | |
from PIL import ImageFile |
This file contains hidden or 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
def stackImages(scale,imgArray): | |
rows = len(imgArray) | |
cols = len(imgArray[0]) | |
rowsAvailable = isinstance(imgArray[0], list) | |
width = imgArray[0][0].shape[1] | |
height = imgArray[0][0].shape[0] | |
if rowsAvailable: | |
for x in range ( 0, rows): | |
for y in range(0, cols): | |
if imgArray[x][y].shape[:2] == imgArray[0][0].shape [:2]: |
This file contains hidden or 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
def convert_to_sequences(tokens:list): | |
''' | |
Function to convert the sequences to tokens. | |
params: | |
tokens(list): The text converted to a list of cleaned tokens. | |
returns: | |
sequnces(list): The list of sequences formed from tokens.abs | |
''' | |
length = 50 + 1 | |
sequences = list() |
This file contains hidden or 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 string | |
import numpy as np | |
from tensorflow.keras.preprocessing.text import Tokenizer | |
from tensorflow.keras.layers import Dense,LSTM,Dropout,Embedding | |
from tensorflow.keras.models import Sequential | |
from tensorflow.keras.utils import to_categorical | |
def load_file(path:str): | |
''' | |
Function to load the text file for training the language model. |
NewerOlder