# Project export: AuthentiScan

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: CruzHacks 2024
- Tagline: AuthentiScan is a web app designed to detect deepfakes and provide a critical tool for verifying the authenticity of digital media with the help of a an AI model.
- Devpost: https://devpost.com/software/authentiscan
- GitHub: https://github.com/RithvikIlluri/cruzhacks2024
- Team: 3 GitHub contributor(s) — Rithvik Illuri (3 commits), pranavarav (2 commits), Akshith Vattem (1 commits)

## Devpost submission (written by the team)

### Inspiration

Fascinated by the power of artificial intelligence in media, we were inspired to create a deepfaking app to explore the boundaries between reality and digital innovation. Our goal was to not only showcase the potential of AI in creating hyper-realistic content but also to raise awareness about the ethical implications and need for responsible use of such powerful technology.

### What it does

Out web-app detect deepfakes and to provide a critical tool for verifying the authenticity of digital media. This not helps to combat the spread of misinformation and protect personal reputations, but it also serves as a frontline defense in maintaining the integrity of online content

### How we built it

We created a video splitter in python, which splits the video into multiple frames. Each frame is then sent through our AI model which detects any inaccuracies in the facial expression of the video. The AI model utilizes neural networks and maseonet class with tenserflow to analyze if it was created with deepfake technology.

### Challenges we ran into

We ran into many challeneges throughout the processs of developing our code however, the ones that were the most challening were finding the right dataset to use and training the AI to get the most accurate results.

### Accomplishments we're proud of

We are proud to have developed a program that is highly effective and accurate when categorizing and detecting deepfake technology.

## README (from the GitHub repository)

No README available.

## Detected evidence (automated analysis)

Indexed codebase: 9 recognized source files, 29 KB.
- HTML (language) — detected in the code
- Python (language) — detected in the code
- JavaScript (language) — claimed on Devpost, not found in the code

## Codebase structure (from repository index)

### Files (11 of 11)

```
frontEnd/homepage.html
frontEnd/main-page.html
frontEnd/url-page.html
hello.txt
homepage.html
html
login-1.html
login.html
main-page.html
main.py
url-page.html
```

### Dependencies

No dependency index available.

### Recent commits (newest first)

- Add files via upload
- Add files via upload
- Add files via upload
- cm1
- commiting login page and url page
- hello.txt
- front-end

## Key source files (fetched from GitHub, selected and truncated for size)

### main.py

```python
import numpy as np
import matplotlib.pyplot as plt  # Removed After Use
from tensorflow.keras.layers import Input, Dense, Flatten, Conv2D, MaxPooling2D, BatchNormalization, Dropout, Reshape, \
    LeakyReLU
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.models import Model
import cv2 as cv

image_dim = {'height': 256, 'width': 256, 'channels': 3}


class Classifier:
    def __init__(self):
        self.model = 0

    def predict(self, x):
        return self.model.predict(x)

    def fit(self, x, y):
        return self.model.train_on_batch(x, y)

    def get_accuracy(self, x, y):
        return self.model.test_on_batch(x, y)

    def load(self, path):
        self.model.load_weights(path)


class Meso4(Classifier):
    def __init__(self, learning_rate=0.0000001):
        self.model = self.init_model()
        optimizer = Adam(learning_rate=learning_rate)
        self.model.compile(optimizer=optimizer,
                           loss='mean_squared_error',
                           metrics=['accuracy'])

    def init_model(self):
        x = Input(shape=(image_dim['height'],
                         image_dim['width'],
                         image_dim['channels']))

        x1 = Conv2D(8, (3, 3), padding='same', activation='relu')(x)
        x1 = BatchNormalization()(x1)
        x1 = MaxPooling2D(pool_size=(2, 2), padding='same')(x1)

        x2 = Conv2D(8, (5, 5), padding='same', activation='relu')(x1)
        x2 = BatchNormalization()(x2)
        x2 = MaxPooling2D(pool_size=(2, 2), padding='same')(x2)

        x3 = Conv2D(16, (5, 5), padding='same', activation='relu')(x2)
        x3 = BatchNormalization()(x3)
        x3 = MaxPooling2D(pool_size=(2, 2), padding='same')(x3)

        x4 = Conv2D(16, (5, 5), padding='same', activation='relu')(x3)
        x4 = BatchNormalization()(x4)
        x4 = MaxPooling2D(pool_size=(4, 4), padding='same')(x4)

        y = Flatten()(x4)
        y = Dropout(0.5)(y)
        y = Dense(16)(y)
        y = LeakyReLU(alpha=0.1)(y)
        y = Dropout(0.5)(y)
        y = Dense(1, activation='sigmoid')(y)

        return Model(inputs=x, outputs=y)


meso = Meso4()
meso.load('./weights/Meso4_DF')

videopath = '/Users/pranavaraveti/Downloads/Deepfake-detection/test/test1.mp4'
cap = cv.VideoCapture(videopath)
fps = int(cap.get(cv.CAP_PROP_FPS))
frame_width = int(cap.get(cv.CAP_PROP_FRAME_WIDTH))
frame_height = int(cap.get(cv.CAP_PROP_FRAME_HEIGHT))
output_path = 'path/to/output/video.mp4'
fourcc = cv.VideoWriter_fourcc(*'mp4v')
out = cv.VideoWriter(output_path, fourcc, fps, (frame_width, frame_height))

while True:
    ret, frame = cap.read()

    if not ret:
        break

    resized_frame = cv.resize(frame, (image_dim['width'], image_dim['height']))
    normalized_frame = resized_frame / 255.0
    input_frame = normalized_frame.reshape((1, image_dim['height'], image_dim['width'], image_dim['channels']))
    prediction = meso.predict(input_frame)
    cv.putText(frame, f"Prediction: {prediction[0][0]:.4f}", (10, 30), cv.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)
    cv.imshow('Frame', frame)
    out.write(frame)

    if cv.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()
out.release()
cv.destroyAllWindows()

```

### main-page.html

```html
<!DOCTYPE html>
<html>
    <head>
        <title>
            AuthentiScan
        </title>
        <style>

            .video-bg{
                position: absolute;
                top:0px;
                left:0px;
                height: 710px;
            }

            .title-1{
                font-family: 'Times New Roman', Times, serif;
                color: white;
                font-size: 55px;
                position: absolute;
                left: 200px;
                top: 350px;
                letter-spacing: 1.5px;
            }
            .text-2{
                color:white;
                font-size: 15px;
                position: absolute;
                top: 435px;
                left: 200px;

            }
            .text-21{
                color:white;
                font-size: 16px;
                position: absolute;
                top: 455px;
                left: 200px;
            }
            .launch-button{

            }
            .big-title{
                color:white;
                font-family: 'Times New Roman', Times, serif
            }
            .header {
            background-color: black;
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 50px;
            display: flex;
            justify-content: space-around;
            align-items: center;
            z-index: 1000;
        }

        .header a {
            text-decoration: none;
            color: #717378;
            font-size: 14px;
            font-weight: bold;
            padding-top: 62px;

        }

        .header a:hover {
            border-bottom: 2px solid white;
        }
        </style>
    </head>
    <body>
        <div class="header">
            <a href="login.html">Login</a>
            <a href="homepage.html">Homepage</a>
            <a href="main-page.html">Main Page</a>
        </div>
            <video class="video-bg" autoplay muted loop>
                <source src="videos/back-vid - Made with Clipchamp.mp4" type="video/mp4">
            </video>
        <h1 class="title-1">
            AuthentiScan
        </h1>
        <p class="text-2">
            "We dedicate ourselves to using AI for originality detection, safegaurding the essence
        </p>
        <p class="text-21">
            of creativity and nurturing a future where innovation thrives."
        </p>
        <button class="launch-button">
            Launch
        </button>
        <h1 class="big-title">
            AuthentiScan
        </h1>
    </body>
</html>
```

### url-page.html

```html
<!DOCTYPE html> 
<html>
    <head>
        <style>
            body {background-color: #1F1A17;}
            .URL{  
                position: absolute;
                top: 600px;     
                left: 50px;
                height: 50px;
                width: 700px;
                border-radius: 20px;
                padding-left: 30px;
                font-size: 20px;
                font-family: arial;
                border: none;
                margin: none;
            }
            .Enter{  
                position: absolute;
                top: 601px;
                left: 580px;
                height: 50px;
                width: 200px;
                border-radius: 20px;
                padding-left: 30px;
                font-size: 20px;
                font-family: arial;
                background-color: gray;
                border: none;
                margin: none;
            }
            .triangle-icon{
                position: absolute;
                height: 75px;
                width: 75px;
                top: 45px;
                left: 50px;
            }
            .AuthentiScan{
                position: absolute;
                top: 25px;
                left: 150px;
                font-size: 40px; 
                color: white;
                font-family: Arial, Helvetica, sans-serif;
            }
            .Line{
                position: absolute;
                left: 900px;
                width: 1px;
                height: 760px;
                background-color: white;
            }
            .Summary{
                position: absolute;
                top: 50px;
                left: 950px;
                font-size: 30px; 
                color: white;
                font-family: Arial, Helvetica, sans-serif;
            }
            .Line2{  
                position: absolute;
                top: 120px;
                left: 950px;
                height: 1px;
                width: 130px;
                background-color: white;
            }
            .SummaryFiller{
                position: absolute;
                top: 125px;
                left: 950px;
                font-size: 12px; 
                color: white;
                font-family: Arial, Helvetica, sans-serif;
            }
        </style>
        <title>
        </title>
        <body>
            <input class="URL" placeholder="Enter a URL">
            </input>
            
            <button class="Enter">
                Enter
            </button>

            <img src="triangle.png" class="triangle-icon">

            <P class="AuthentiScan">
                AuthentiScan
             </P>

             <P class="Summary">
                Summary
             </P>

             <div class="Line"> 

             </div>

             <div class="Line2">

             </div>

             <P class="SummaryFiller">
                Filler
             </P>

        </body>
    </head> 
</html>
```

### homepage.html

```html
<!DOCTYPE html>
<html>
    <head>
        <img src="images/cruzhacks-logo.png" class="logo">
        <title>
            AuthentiScan
        </title>
        <style>
            body {background-color: #261204;}
            .border-1{
                background-color: white;
                width: 1px;
                height: 574px;
                position: absolute;
                left: 150px;
            }
            
            
            .URL-box{
                position: absolute;
                position: absolute;
                width: 500px;
                height: 50px;
                left: 450px;
                right: 300px;
                top: 450px;
                border-radius: 20px;
                padding-left: 20px;
                font-size: 15px;
                border: none;
                margin: none;
                box-shadow: 5px;
            }
            .logo{
                height: 450px;
                position: absolute;
                left: 475px;
                right: 250px;
                top:50px;
                bottom:100px;
            }
            .name{
                font-family: arial;
                font-size: 35px;
                color: white;
                position: absolute;
                left: 400px;
                
            }
            .login-button{
                position: absolute;
                right: 30px;
                top: 35px;
                height: 50px;
                width: 175px;
                border-radius: 20px;
                font-size: 17px;
                border: none;
                margin: none;
            }
            .login_button:hover{
                cursor: pointer;
            }

            .signup-button{
                position: absolute;
                right: 215px;
                top: 35px;
                height: 50px;
                width: 175px;
                border-radius: 20px;
                font-size: 17px;
                border: none;
                margin: none;
            }
            .check-button{
                height: 52px;
                width: 150px;
                border-radius: 20px;
                border: none;
                margin: none;
                position: absolute;
                left: 822px;
                top: 450px;
                background-color: grey;
            }
            .check-button:hover{
                cursor: pointer;
            }
            .signup-button:hover{
                cursor: pointer;
            }
            .login-button:hover {
                cursor: pointer;
            }
            .check-button:active {
                transform: scale(0.96);
                transition: opacity 1s;
            }
        </style>
        <body>
            <input type="text" placeholder="URL" class="URL-box">
            <div class="border-1">

            </div>
            
            <p class="name">
                AuthentiScan
            </p>
            <button class="login-button">
                Login
            </button>
            <button class="signup-button">
                Signup
            </button>
            <button class="check-button">
                Check
            </button>
        </body>

    </head>
</html>
```

### login.html

```html
<!DOCTYPE html> 
<html>
    <head>
       54
        <style>
            body {background-color: black;}
            .button-1{  
                position: absolute;
                top: 300px;     
                left: 190px;
                height: 100px;
                width: 500px;
                border-radius: 20px;
                padding-left: 30px;
                font-size: 20px;
                font-family: arial;
            }
            .button-2{  
                position: absolute;
                top: 300px;
                right: 190px;
                height: 100px;
                width: 475px;
                border-radius: 20px;
                padding-left: 30px;
                font-size: 20px;
                font-family: arial;
            }
            .button-3{  
                position: absolute;
                top: 425px;
                left: 190px;
                height: 100px;
                width: 775px;
                border-radius: 20px;
                padding-left: 30px;
                font-size: 20px;
                font-family: arial;
            }
            .button-4{  
                position: absolute;
                top: 425px;
                right: 190px;
                height: 105px;
                width: 235px;
                border-radius: 20px;
                font-size: 20px;
                font-family: arial;
                
            }
            .Line1{  
                position: absolute;
                top: 540px;
                left: 190px;
                height: 1px;
                width: 515px;
                background-color: white;
            }
            .Line2{  
                position: absolute;
                top: 540px;
                right: 190px;
                height: 1px;
                width: 500px;
                background-color: white;
            }
            .Or{
                position: absolute;
                right: 706px;
                top: 520px;
                color: white;
                font-size: 13px;
                font-family: arial;
            }
            .Google{  
                position: absolute;
                top: 550px;
                left: 190px;
                height: 100px;
                width: 1060px;
                border-radius: 20px;
                padding-left: 30px;
                font-size: 22px;
                font-family: arial;
            }
            .Scan{
                position: absolute;
                right: 570px;
                top: 100px;
                font-size: 50px;
                font-family: arial;
                color: white;
                background-color: black;
                border: none;
                margin: none;
                font-family: 'Times New Roman', Times, serif;
            }
            .google-icon{
                height: 60px;
                position: absolute;
                left: 220px;
                top: 570px;
            }
            .Scan:active{
                transform: scale(0.96)
            }
            
        </style>
        <title>
        </title>
        <body>
            <input class="button-1" placeholder="First Name">
            </input>
            
            <input class="button-2" placeholder="Last Name">
            </input>

             <input class="button-3" placeholder="Enter Email">
            </input>

             <button class="button-4" placeholder="Enter">
                Enter
             </button>

             <button class="Google">
                Sign in with Google
             </button>
            
             <div class="Line1">

             </div>

             <div class="Line2">

             </div>

             <P class="Or">
                Or
             </P>

             <button class="Scan">
                AuthentiScan
             </button>

             <img src="google.png" class="google-icon">

             


        </body>
    </head> 
</html>
```

### login-1.html

```html
<!DOCTYPE html> 
<html>
    <head>
       54
        <style>
            body {background-color: #1F1A17;}
            .button-1{  
                position: absolute;
                top: 300px;     
                left: 190px;
                height: 100px;
                width: 500px;
                border-radius: 20px;
                padding-left: 30px;
                font-size: 20px;
                font-family: arial;
            }
            .button-2{  
                position: absolute;
                top: 300px;
                right: 190px;
                height: 100px;
                width: 475px;
                border-radius: 20px;
                padding-left: 30px;
                font-size: 20px;
                font-family: arial;
            }
            .button-3{  
                position: absolute;
                top: 425px;
                left: 190px;
                height: 100px;
                width: 775px;
                border-radius: 20px;
                padding-left: 30px;
                font-size: 20px;
                font-family: arial;
            }
            .button-4{  
                position: absolute;
                top: 425px;
                right: 190px;
                height: 105px;
                width: 235px;
                border-radius: 20px;
                font-size: 20px;
                font-family: arial;
                
            }
            .Line1{  
                position: absolute;
                top: 540px;
                left: 190px;
                height: 1px;
                width: 515px;
                background-color: white;
            }
            .Line2{  
                position: absolute;
                top: 540px;
                right: 190px;
                height: 1px;
                width: 500px;
                background-color: white;
            }
            .Or{
                position: absolute;
                right: 706px;
                top: 520px;
                color: white;
                font-size: 13px;
                font-family: arial;
            }
            .Google{  
                position: absolute;
                top: 550px;
                left: 190px;
                height: 100px;
                width: 1060px;
                border-radius: 20px;
                padding-left: 30px;
                font-size: 22px;
                font-family: arial;
            }
            .Scan{
                position: absolute;
                right: 570px;
                top: 100px;
                font-size: 50px;
                font-family: arial;
                color: white;
                background-color: #1F1A17;
                border: none;
                margin: none;
                font-family: 'Times New Roman', Times, serif;
            }
            .google-icon{
                height: 60px;
                position: absolute;
                left: 220px;
                top: 570px;
            }
            .Scan:active{
                transform: scale(0.96)
            }
            
        </style>
        <title>
        </title>
        <body>
            <input class="button-1" placeholder="First Name">
            </input>
            
            <input class="button-2" placeholder="Last Name">
            </input>

             <input class="button-3" placeholder="Enter Email">
            </input>

             <button class="button-4" placeholder="Enter">
                Enter
             </button>

             <button class="Google">
                Sign in with Google
             </button>
            
             <div class="Line1">

             </div>

             <div class="Line2">

             </div>

             <P class="Or">
                Or
             </P>

             <button class="Scan">
                AuthentiScan
             </button>

             <img src="google.png" class="google-icon">

             


        </body>
    </head> 
</html>
```

### frontEnd/main-page.html

```html
<!DOCTYPE html>
<html>
    <head>
        <title>
            AuthentiScan
        </title>
        <style>

            .video-bg{
                position: absolute;
                top:0px;
                left:0px;
                height: 710px;
            }

            .title-1{
                font-family: 'Times New Roman', Times, serif;
                color: white;
                font-size: 55px;
                position: absolute;
                left: 200px;
                top: 350px;
                letter-spacing: 1.5px;
            }
            .text-2{
                color:white;
                font-size: 15px;
                position: absolute;
                top: 435px;
                left: 200px;

            }
            .text-21{
                color:white;
                font-size: 16px;
                position: absolute;
                top: 455px;
                left: 200px;
            }
            .launch-button{

            }
            .big-title{
                color:white;
                font-family: 'Times New Roman', Times, serif
            }
            .header {
            background-color: black;
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 50px;
            display: flex;
            justify-content: space-around;
            align-items: center;
            z-index: 1000;
        }

        .header a {
            text-decoration: none;
            color: #717378;
            font-size: 14px;
            font-weight: bold;
            padding-top: 62px;

        }

        .header a:hover {
            border-bottom: 2px solid white;
        }
        </style>
    </head>
    <body>
        <div class="header">
            <a href="login.html">Login</a>
            <a href="homepage.html">Homepage</a>
            <a href="main-page.html">Main Page</a>
        </div>
            <video class="video-bg" autoplay muted loop>
                <source src="videos/back-vid - Made with Clipchamp.mp4" type="video/mp4">
            </video>
        <h1 class="title-1">
            AuthentiScan
        </h1>
        <p class="text-2">
            "We dedicate ourselves to using AI for originality detection, safegaurding the essence
        </p>
        <p class="text-21">
            of creativity and nurturing a future where innovation thrives."
        </p>
        <button class="launch-button">
            Launch
        </button>
        <h1 class="big-title">
            AuthentiScan
        </h1>
    </body>
</html>

```

### frontEnd/homepage.html

```html
!DOCTYPE html>
<html>
    <head>
        <img src="images/cruzhacks-logo.png" class="logo">
        <title>
            AuthentiScan
        </title>
        <style>
            body {background-color: #261204;}
            .border-1{
                background-color: white;
                width: 1px;
                height: 574px;
                position: absolute;
                left: 150px;
            }
           
           
            .URL-box{
                position: absolute;
                position: absolute;
                width: 500px;
                height: 50px;
                left: 450px;
                right: 300px;
                top: 450px;
                border-radius: 20px;
                padding-left: 20px;
                font-size: 15px;
                border: none;
                margin: none;
                box-shadow: 5px;
            }
            .logo{
                height: 450px;
                position: absolute;
                left: 475px;
                right: 250px;
                top:50px;
                bottom:100px;
            }
            .name{
                font-family: arial;
                font-size: 35px;
                color: white;
                position: absolute;
                left: 400px;
               
            }
            .login-button{
                position: absolute;
                right: 30px;
                top: 35px;
                height: 50px;
                width: 175px;
                border-radius: 20px;
                font-size: 17px;
                border: none;
                margin: none;
            }
            .login_button:hover{
                cursor: pointer;
            }

            .signup-button{
                position: absolute;
                right: 215px;
                top: 35px;
                height: 50px;
                width: 175px;
                border-radius: 20px;
                font-size: 17px;
                border: none;
                margin: none;
            }
            .check-button{
                height: 52px;
                width: 150px;
                border-radius: 20px;
                border: none;
                margin: none;
                position: absolute;
                left: 822px;
                top: 450px;
                background-color: grey;
            }
            .check-button:hover{
                cursor: pointer;
            }
            .signup-button:hover{
                cursor: pointer;
            }
            .login-button:hover {
                cursor: pointer;
            }
            .check-button:active {
                transform: scale(0.96);
                transition: opacity 1s;
            }
        </style>
        <body>
            <input type="text" placeholder="URL" class="URL-box">
            <div class="border-1">

            </div>
           
            <p class="name">
                AuthentiScan
            </p>
            <button class="login-button">
                Login
            </button>
            <button class="signup-button">
                Signup
            </button>
            <button class="check-button">
                Check
            </button>
        </body>

    </head>
</html>

```

### frontEnd/url-page.html

```html
<!DOCTYPE html>
<html>
    <head>
        <style>
            body {background-color: #1F1A17;}
            .URL{
                position: absolute;
                top: 600px;
                left: 50px;
                height: 50px;
                width: 700px;
                border-radius: 20px;
                padding-left: 30px;
                font-size: 20px;
                font-family: arial;
                border: none;
                margin: none;
            }
            .Enter{
                position: absolute;
                top: 601px;
                left: 580px;
                height: 50px;
                width: 200px;
                border-radius: 20px;
                padding-left: 30px;
                font-size: 20px;
                font-family: arial;
                background-color: gray;
                border: none;
                margin: none;
            }
            .triangle-icon{
                position: absolute;
                height: 75px;
                width: 75px;
                top: 45px;
                left: 50px;
            }
            .AuthentiScan{
                position: absolute;
                top: 25px;
                left: 150px;
                font-size: 40px;
                color: white;
                font-family: Arial, Helvetica, sans-serif;
            }
            .Line{
                position: absolute;
                left: 900px;
                width: 1px;
                height: 760px;
                background-color: white;
            }
            .Summary{
                position: absolute;
                top: 50px;
                left: 950px;
                font-size: 30px;
                color: white;
                font-family: Arial, Helvetica, sans-serif;
            }
            .Line2{
                position: absolute;
                top: 120px;
                left: 950px;
                height: 1px;
                width: 130px;
                background-color: white;
            }
            .SummaryFiller{
                position: absolute;
                top: 125px;
                left: 950px;
                font-size: 12px;
                color: white;
                font-family: Arial, Helvetica, sans-serif;
            }
            .URL-input{
                position: absolute;
                color: gray;
                width: 300px;
                height: 50px;
                left: 200px;
                top: 500px;

            }
            .submit-button{
                position: absolute;
                color: gray;
                width: 70px;
                height: 55px;
                left: 500px;
                top: 500px;
            }
        </style>
        <title>
        </title>
        <body>
              <form action="/process_text" method="POST">
            <input type="text" name="user_text" class="URL-input" placeholder="Enter URL">
            <button type="submit" class="submit-button">Submit</button>
            </form>




            <img src="triangle.png" class="triangle-icon">

            <P class="AuthentiScan">
                AuthentiScan
             </P>

             <P class="Summary">
                Summary
             </P>

             <div class="Line">

             </div>

             <div class="Line2">

             </div>

             <P class="SummaryFiller">
                Filler
             </P>

        </body>
    </head>
</html>

```