Skip to content

Commit

Permalink
fix: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Logan-Fouts committed May 18, 2024
1 parent 6cd1540 commit f40199f
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 36 deletions.
6 changes: 4 additions & 2 deletions Client/src/components/Banner.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import React from "react";
import "./Banner.css";
import logo from "./images/logo-no-background.png";

function Banner() {
const handleHelpClick = () => {
// Replace 'https://your-help-page-url.com' with the actual URL of your help page
window.open("https://github.com/Logan-Fouts/PicPurge/blob/GUI/README.md", "_blank");
window.open(
"https://github.com/Logan-Fouts/PicPurge/blob/GUI/README.md",
"_blank",
);
};

return (
Expand Down
10 changes: 5 additions & 5 deletions Client/src/components/Darkmode.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React from 'react';
import * as Switch from '@radix-ui/react-switch';
import './Darkmode.css';
import * as Switch from "@radix-ui/react-switch";
import "./Darkmode.css";

const Darkmode = () => (
<form>
<div style={{ display: 'flex', alignItems: 'center'}}>
<div style={{ display: "flex", alignItems: "center" }}>
<Switch.Root className="SwitchRoot">
<Switch.Thumb className="SwitchThumb" />
</Switch.Root>
</div>
</form>
);

export default Darkmode;
export default Darkmode;

2 changes: 0 additions & 2 deletions Client/src/components/Options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import React, { useState, useEffect } from "react";
import "./Options.css";
import DetectionWheel from "./DetectionWheel";
import ProgressBar from "./Progress";
import Fire from "./Fire";
import Darkmode from "./Darkmode";

function Options() {
const [folderPath, setFolderPath] = useState("");
Expand Down
6 changes: 3 additions & 3 deletions Client/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})
});
Binary file not shown.
5 changes: 5 additions & 0 deletions Electron/Framework/Integration/Layers/layers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import random
import shutil
import time
import sys

from Wrapper.wrapper import Wrapper
Expand Down Expand Up @@ -99,6 +100,10 @@ def _setup_further_processing(self, duplicates, image_paths):
lst = [item for tup in self.result_duplicates for item in tup]
curr_paths = set(image_paths) - set(lst)

for _ in range(len(curr_paths)):
print("Duplicate_Found_Message")
time.sleep(0.0001)

self.result_duplicates = self.group_related_images(self.result_duplicates)

for group in self.result_duplicates:
Expand Down
65 changes: 47 additions & 18 deletions Electron/Framework/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,64 @@ def get_image_paths(directory):
return paths


def main(image_dir):
def main(image_dir, preset):
"""
Takes args and runs specified layered architecture.
"""
image_paths = get_image_paths(image_dir)
layers = []

layers = [
Dhash(sim=True, threshold=0.9),
Phash(threshold=11),
VGG(threshold=0.7),
SIFT(
threshold=16,
sigma=1.6,
edge_threshold=10,
n_octave_layers=3,
contrast_threshold=0.04,
image_ratio=0.1,
),
] # Normal case
match preset:
case 1:
layers = [
Dhash(sim=True, threshold=0.9),
Phash(threshold=11),
VGG(threshold=0.7),
SIFT(
threshold=16,
sigma=1.6,
edge_threshold=10,
n_octave_layers=3,
contrast_threshold=0.04,
image_ratio=0.1,
),
] # Personal Photo Library
case 2:
layers = [
Phash(threshold=4),
Dhash(sim=True, threshold=0.95),
SIFT(
threshold=13,
sigma=1.2,
edge_threshold=1000**10,
n_octave_layers=8,
contrast_threshold=0.01,
),
] # Fingerprinting
case 3:
print("TODO")
case 4:
print("TODO")
case 5:
print("TODO")
case 6:
print("TODO")
case 7:
print("TODO")
case 8:
print("TODO")

layered_architecture = Layers(layers)
layered_architecture.run(image_paths)
layered_architecture.print_final_results()
if layers:
layered_architecture = Layers(layers)
layered_architecture.run(image_paths)
layered_architecture.print_final_results()


if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Find duplicate images.")
parser.add_argument(
"folder_path", type=str, help="Path to the folder containing images."
)
parser.add_argument("preset", type=int, help="Include preset index.")
args = parser.parse_args()
main(args.folder_path)
main(args.folder_path, args.preset)
6 changes: 3 additions & 3 deletions Electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function createWindow() {
},
});

// mainWindow.setMenu(null);
mainWindow.setMenu(null);
mainWindow.loadURL(url);
}

Expand Down Expand Up @@ -54,9 +54,9 @@ ipcMain.handle("openFileExplorer", async (event) => {

ipcMain.handle(
"runScript",
async (event, folderPath, aggressiveness, removeNonMedia) => {
async (event, folderPath, preset, removeNonMedia) => {
let pythonArgs = null;
pythonArgs = [String(folderPath)];
pythonArgs = [String(folderPath), String(preset)];
const progressUpdates = [];

try {
Expand Down
6 changes: 3 additions & 3 deletions Electron/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ contextBridge.exposeInMainWorld("electronAPI", {
const selectedPath = await ipcRenderer.invoke("openFileExplorer");
return selectedPath;
},
process: async (folderPath, aggressiveness, removeNonMedia) => {
process: async (folderPath, preset, removeNonMedia) => {
const progressUpdates = await ipcRenderer.invoke(
"runScript",
folderPath,
aggressiveness,
removeNonMedia
preset,
removeNonMedia,
);
},
receive: (channel, callback) => {
Expand Down

0 comments on commit f40199f

Please sign in to comment.