21
loading...
This website collects cookies to deliver better user experience
<script src='parse/dist/parse.min.js'></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/parse/3.1.0/parse.min.js"></script>
window.location.replace("pageDirectedToNext.html");
async function signup(){
Parse.initialize(
"VmVG7QHqLMLl55A7HBS41M9VVEcHSBkOLRYPMFrV",
"Fn00cz1HubhArl6Qe3htiqjSVFBRzzkPHfMGOFEY"
);
Parse.serverURL = 'https://pg-app-x0nn57scg4turute43zp66450ts38l.scalabl.cloud/1/';
const signup_username = document.getElementById("username-field").value;
const signup_password = document.getElementById("password-field").value;
const user = new Parse.User();
user.set("username", signup_username);
user.set("email", signup_username);
user.set("password", signup_password);
try {
await user.signUp();
document.getElementById("status-message").innerHTML = "Successfully Signed Up " + signup_username;
}
catch (error) {
document.getElementById("status-message").innerHTML = "Error: " + error.code + " " + error.message;
}
}
async function login(){
Parse.initialize(
"VmVG7QHqLMLl55A7HBS41M9VVEcHSBkOLRYPMFrV",
"Fn00cz1HubhArl6Qe3htiqjSVFBRzzkPHfMGOFEY"
);
Parse.serverURL = 'https://pg-app-x0nn57scg4turute43zp66450ts38l.scalabl.cloud/1/';
const login_username = document.getElementById("username-field").value;
const login_password = document.getElementById("password-field").value;
try{
await Parse.User.logIn(login_username, login_password);
document.getElementById("status-message").innerHTML = "Successfully Logged In: " + login_username;
window.location.replace("contribute.html");
}
catch (error) {
document.getElementById("status-message").innerHTML = "Error: " + error.code + " " + error.message;
}
}
function submitLocation(){
Parse.initialize(
"VmVG7QHqLMLl55A7HBS41M9VVEcHSBkOLRYPMFrV",
"Fn00cz1HubhArl6Qe3htiqjSVFBRzzkPHfMGOFEY"
);
Parse.serverURL = 'https://pg-app-x0nn57scg4turute43zp66450ts38l.scalabl.cloud/1/';
const LocationObject = Parse.Object.extend("Location");
const lat_input = document.getElementById("lat-field").value;
const long_input = document.getElementById("long-field").value;
const location = new LocationObject();
location.set("latitude", lat_input);
location.set("longitude", long_input);
location.save()
.then((location) => {
// Execute any logic that should take place after the object is saved.
alert('Response Submitted! Now you are being directed to our sitewide map.');
}, (error) => {
// Execute any logic that should take place if the save fails.
// error is a Parse.Error with an error code and message.
alert('Failed to create new object, with error code: ' + error.message);
});
window.location.replace("map.html"); //removes current html page and puts in map.html
}
model = await tmImage.load(modelURL, metadataURL);
const prediction = await model.predict(image);
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@teachablemachine/[email protected]/dist/teachablemachine-image.min.js"></script>
async function loadFile(){
Parse.initialize(
"VmVG7QHqLMLl55A7HBS41M9VVEcHSBkOLRYPMFrV",
"Fn00cz1HubhArl6Qe3htiqjSVFBRzzkPHfMGOFEY"
);
Parse.serverURL = 'https://pg-app-x0nn57scg4turute43zp66450ts38l.scalabl.cloud/1/';
file = event.target.files[0]; //image put in by user
//creating a imgur link with the file put in by the user
const formdata = new FormData();
formdata.append("image", file);
fetch("https://api.imgur.com/3/image/", {
method: "post",
headers: {
Authorization: "Client-ID 14e494303e30a2d"
}
, body: formdata
}).then(data => data.json()).then(data => {
link = data.data.link;
})
var image = document.getElementById('output');
image.src = URL.createObjectURL(event.target.files[0]);
const mainmodelURL = "https://teachablemachine.withgoogle.com/models/b2ldFt-gT/";
const modelURL = mainmodelURL + "model.json";
const metadataURL = mainmodelURL + "metadata.json";
model = await tmImage.load(modelURL, metadataURL);
maxPredictions = model.getTotalClasses();
const prediction = await model.predict(image);
var classPrediction = "";
if (parseFloat(prediction[0].probability.toFixed(2))>=parseFloat(prediction[1].probability.toFixed(2))){
classPrediction = prediction[0].className + ": " + prediction[0].probability.toFixed(2);
healthy = "green";
}
else {
classPrediction = prediction[1].className + ": " + prediction[1].probability.toFixed(2);
healthy = "red";
}
document.getElementById("image-results").innerHTML = classPrediction;
}
const Location = Parse.Object.extend("Location");
const query = new Parse.Query("Location");
const results = await query.find();
for(var i = 0; i < results.length; i++){
var dict = {"position": new google.maps.LatLng(results[i].get('latitude'), results[i].get('longitude')), "type":results[i].get('health'), "link":results[i].get('photo_link')};
features.push(dict);
}