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 sys | |
import os | |
import numpy as np | |
from PIL import Image as pil_image | |
from keras.applications.vgg16 import VGG16, preprocess_input, decode_predictions | |
def predictPicture(picturePath): | |
mod = VGG16() #Calling VGG16 Model | |
img = pil_image.open(picturePath) #loading picture |
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 keras | |
from keras import backend as K | |
from keras.models import Sequential | |
from keras.layers import Activation | |
from keras.layers.core import Dense, Flatten | |
from keras.optimizers import Adam | |
from keras.metrics import categorical_crossentropy, sparse_categorical_crossentropy | |
from keras.preprocessing.image import ImageDataGenerator, load_img, img_to_array | |
from keras.layers.normalization import BatchNormalization |
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
async function markovChain(){ | |
let amazonDataSetFile = await utils.readFileLineByLine('../dataset/AmazonDataSet.txt') | |
let ourDataSet = await utils.readFileLineByLine('../dataset/sentences.txt') | |
let filteredData = amazonDataSetFile.filter((comments) => { | |
if(comments.includes("taste") || comments.includes("yummy") || comments.includes("good") || comments.includes("cooking") || comments.includes("delicious") || comments.includes("savory") || comments.includes("devour")){ | |
return comments | |
} | |
}) | |
filteredData = filteredData.slice(0,3500) | |
let bothDataSetsTogether = [...filteredData,...ourDataSet] |
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
const titlegen = require('titlegen'); | |
const utils = require('./utils.js'); | |
async function generate(path,howManyChain){ | |
return new Promise(async function(resolve,reject){ | |
let generator = titlegen.create(); | |
let finalTextMarkov = [] | |
let dataset = []; |
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
const utils = require('../src/utils.js'); | |
const generateCommentsFromHandMadeData = require('../src/generateCommentsFromHandMadeData.js') | |
const howManyIterations = 99999; | |
let allSentences = []; | |
let sentencesAboutPicture ={ | |
"mainSentence": [ | |
"I love photography, it transmits $", | |
"The photo talks about $", |
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
const utils = require('../src/utils.js'); | |
const generateCommentsFromHandMadeData = require('../src/generateCommentsFromHandMadeData.js') | |
let sentencesAboutPicture ={ | |
"mainSentence": [ | |
"I love photography, it transmits $", | |
"The photo talks about $", | |
"Just '$'", | |
"Beyond photography you can perceive: $", | |
"$!", |
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
const utils = require('../src/utils.js'); | |
const generateCommentsFromHandMadeData = require('../src/generateCommentsFromHandMadeData.js') | |
let sentencesAboutFood = { | |
"mainSentence":[ | |
"This picture looks $", | |
"Looks $, i love your pictures", | |
"I want to try that food, it looks $", | |
"It seems $" | |
], |
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
const fs = require('fs'); | |
const readline = require('readline'); | |
function randomInt(min,max){ | |
return Math.round(Math.random() * (max-min)+ min) | |
} | |
function saveArrayToTxtLineByLine(arrFinal,pathOutput){ | |
return new Promise(function(resolve,reject){ | |
let fileToSave = deleteRepeatedValuesOnArray(arrFinal) |
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
const utils = require('./utils.js'); | |
function generate(listVerbs,listSentences,emojis = false,listEmojis = [], emojisRandomChance = 3){ | |
return new Promise( function(resolve, reject){ | |
let getAllSentences = [] | |
for(let i = 0 ; i < listSentences.length; i++){ | |
let sentenceToReplace = listSentences[i] | |
for(let j = 0 ; j < listVerbs.length;j++){ | |
sentenceToReplace = sentenceToReplace.replace("$",listVerbs[j]) |
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
int distance = calculateDistance(circle1.center, circle2.center); | |
int r1 = circle1.radius(); | |
int r2 circle2.radius(); | |
boolean overlap = distance < r1+r2; |