Skip to content

Commit

Permalink
Merge pull request #14 from Saifkhan-rkp/devashish
Browse files Browse the repository at this point in the history
Devashish
  • Loading branch information
Devashish1910 authored Mar 11, 2024
2 parents ea0e364 + 0f9a2e0 commit c1665d1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
5 changes: 4 additions & 1 deletion FRONTEND.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import os
import time
import base64

from st_pages import show_pages, Page, add_page_title

st.title("Image Forgery Detector")


def set_background(image_file):
Expand All @@ -26,7 +28,8 @@ def set_background(image_file):
</style>
"""
st.markdown(style, unsafe_allow_html=True)
st.title("Image Forgery Detector")



show_pages(
[
Expand Down
31 changes: 28 additions & 3 deletions confidence.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,25 @@
import streamlit as st
import os
import time
import base64
from st_pages import show_pages, Page, add_page_title

def set_background(image_file):
with open(image_file, "rb") as f:
img_data = f.read()
b64_encoded = base64.b64encode(img_data).decode()
style = f"""
<style>
.stApp {{
background-image: url(data:image/png;base64,{b64_encoded});
background-size:cover;
}}
</style>
"""
st.markdown(style, unsafe_allow_html=True)

show_pages(
[
Expand All @@ -16,7 +33,15 @@
# Page("image-forgery-detector.ipynb","image-forgery-detector.ipynb", "3️⃣"),
]
)

def show_sample_images_sidebar():
sample_images = ["photo.jpg", "photo1.jpg"]

st.sidebar.subheader("Sample Images for Testing:")

for idx, image_path in enumerate(sample_images):
st.sidebar.image(image_path, caption=f"Sample Image {idx+1}", use_column_width=True)


def convert_to_ela_image(path, quality):
temp_filename = 'temp_file_name.jpg'
ela_filename = 'temp_ela.png'
Expand Down Expand Up @@ -45,9 +70,9 @@ def prepare_image(image_path):

def main():
st.title("Image Forgery Detector")

set_background("bg3.png")
uploaded_file = st.file_uploader("Calculate Percentage Confidence...", type=["jpg", "jpeg", "png"])

show_sample_images_sidebar()
if uploaded_file is not None:
st.image(uploaded_file, caption="Uploaded Image.", use_column_width=True)
st.write("")
Expand Down
Binary file modified requirements.txt
Binary file not shown.

0 comments on commit c1665d1

Please sign in to comment.