Commit ·
8c4de45
1
Parent(s): dff2e94
Rename SMCP.html to SMCP-AI.html
Browse filesSMCP-AI is a AI made using HTML, CCS, & JavaScript is a AI that predicts if your content will blow up or not
Files changed (2)
- SMCP-AI.htmlAdded+116
- SMCP.htmlDeleted-22
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116<!DOCTYPE html><html> <head> <title>Social Media Prediction</title> <style> /* CSS styles for the container */ .container { width: 80%; margin: 0 auto; padding: 20px; background-color: #f2f2f2; border: 1px solid #ccc; border-radius: 5px; font-family: Arial, sans-serif; } h1 { text-align: center; font-size: 36px; margin-bottom: 30px; } p { font-size: 18px; margin-bottom: 10px; } input[type="text"], input[type="file"], button { display: block; width: 100%; margin-bottom: 20px; padding: 10px; border: 1px solid #ccc; border-radius: 5px; font-size: 16px; } button { background-color: #4CAF50; color: white; font-weight: bold; cursor: pointer; } h2 { text-align: center; font-size: 24px; margin-top: 30px; } </style> </head> <body> <div class="container"> <h1>Social Media Prediction</h1> <p>Enter your social media caption:</p> <input type="text" id="textInput" placeholder="Enter caption here..."> <p>Upload your image:</p> <input type="file" id="imageInput"> <button id="predictButton">Predict</button> <h2 id="result"></h2> </div>
<script> /* JavaScript code for checking the caption, identifying the image, and calculating the points */ function checkCaption(textInput) { var points = 0; if (textInput.match(/#[a-zA-Z0-9]+/g)) { points += 5; } if (textInput.match(/@[a-zA-Z0-9]+/g)) { points += 2; } if (textInput.match(/[a-zA-Z]+/g)) { points += 10; } return points; }
function identifyImage(imageInput) { return new Promise(function(resolve, reject) { var reader = new FileReader(); reader.onload = function(e) { var img = new Image(); img.onload = function() { var colorThief = new ColorThief(); var colors = colorThief.getPalette(img, 100); var numColors = colors.length; resolve(numColors); } img.src = e.target.result; } reader.readAsDataURL(imageInput); }); }
function calculatePoints(captionPoints, imagePoints) { var totalPoints = captionPoints + imagePoints; if (totalPoints >= 1 && totalPoints <= 10) { return "Bad"; } else if (totalPoints >= 11 && totalPoints <= 30) { return "Good"; } else if (totalPoints >= 31 && totalPoints <= 100) { return "Very Good"; } else if (totalPoints >= 101) { return "Viral"; } }
document.getElementById("predictButton").addEventListener("click", function() { var textInput = document.getElementById("textInput").value; var imageInput = document.getElementById("imageInput").files[0]; var captionPoints = checkCaption(textInput); identifyImage(imageInput).then(function(imagePoints) { var result = calculatePoints(captionPoints, imagePoints); document.getElementById("result").innerHTML = result; }); }); </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/color-thief/2.3.2/color-thief.min.js"></script> </body> </html>12345678910111213141516171819202122<!DOCTYPE html><html> <head> <title>Social Media Prediction</title> <link rel="stylesheet" type="text/css" href="SMCP-styles.css"> </head> <body> <div class="container"> <h1>Social Media Prediction</h1> <p>Enter your social media caption:</p> <input type="text" id="textInput" placeholder="Enter caption here..."> <p>Upload your image:</p> <input type="file" id="imageInput"> <button id="predictButton">Predict</button> <h2 id="result"></h2> </div>
<script src="caption-checker.js"></script> <script src="image-identify.js"></script> <script src="others.js"></script> </body></html>SMCP-AI.htmlAdded+116
SMCP.htmlDeleted-22