Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web controls and errors #33

Merged
merged 3 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions SvelteApp/src/lib/Navbar/Navbar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
</nav>

<style lang="postcss">
/* Navbar */
.Navbar {
display: flex;
align-items: center;
Expand All @@ -50,7 +49,6 @@
z-index: 20;
}

/* LeftSide and RightSide */
.LeftSide,
.RightSide {
display: flex;
Expand All @@ -60,20 +58,18 @@
}

.RightSide {
display: none; /* Inizialmente nascosto sui piccoli schermi */
display: none;
}

/* LeftSide Styling */
.LeftSide {
color: var(--primary);
}

h1 {
font-size: 20px; /* Utilizzo dei pixel */
font-size: 20px;
font-weight: 600;
}

/* DropdownMenu */
.DropdownMenu {
display: block;
space-y: 10px;
Expand All @@ -90,10 +86,8 @@
position: absolute;
right: 0;
top: 71px;
display: none; /* Inizialmente nascosto sui piccoli schermi */
display: none;
}

/* HiddenOnMobileMenu */
.HiddenOnMobileMenu {
margin-right: 50px;
display: flex;
Expand All @@ -107,25 +101,23 @@
background-color: var(--panel);
border: none;
}
/* Links */
a {
text-decoration: none;
color: var(--primary);
transition: all 0.5s ease-in-out;
transform: scale(1);
font-size: 16px; /* Utilizzo dei pixel */
font-size: 16px;
}

a:hover {
color: var(--white);
transform: scale(1.1);
}

/* Media Queries */
@media (max-width: 767px) {
.RightSide,
.DropdownMenu {
display: flex; /* Mostra sui piccoli schermi */
display: flex;
}

.HiddenOnMobileMenu {
Expand All @@ -136,7 +128,7 @@
@media (min-width: 768px) and (max-width: 1023px) {
.RightSide,
.DropdownMenu {
display: none; /* Nascondi sui media schermi e oltre */
display: none;
}
}
</style>
18 changes: 9 additions & 9 deletions SvelteApp/src/lib/components/Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@
font-family: "Montreal", sans-serif;
background-color: var(--primary);
color: var(--black);
border-radius: 12px; /* per rounded-lg */
border-radius: 12px;
display: flex;
align-items: center;
text-align: center;
justify-content: center;
gap: 8px; /* per gap-2 */
padding: 8px 16px; /* per px-4 e py-2 */
gap: 8px;
padding: 8px 16px;
align-items: center;

text-decoration: none;
/* Animazione */
transition: all 0.5s ease-in-out;
transform: scale(1.05); /* per hover:scale-105 */
border: 2px solid transparent; /* per border-2 border-transparent */
background-color: var(--primary); /* per focus:bg-white */
transform: scale(1.05);
border: 2px solid transparent;
background-color: var(--primary);

/* per hover */
&:hover {
border-color: var(--primary); /* per hover:border-primary */
transform: scale(1.1); /* per hover:lg:scale-110 */
border-color: var(--primary);
transform: scale(1.1);
}
}
</style>
7 changes: 6 additions & 1 deletion SvelteApp/src/lib/components/InsertUrlCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
<UrlIcon />
<slot />
</div>
<input name="url" placeholder="www.google.com" />
<input
required
pattern="https?://[^\s]+"
name="url"
placeholder="www.google.com"
/>
</div>

<style>
Expand Down
10 changes: 9 additions & 1 deletion SvelteApp/src/lib/components/InsertUrlCardGet.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
<UrlIcon />
<slot />
</div>
<input name="url" placeholder="www.google.com" />
<input
required
pattern="https?://[^\s]+"
name="url"
placeholder="www.google.com"
/>
</div>
<Button>Start</Button>
</form>
Expand Down Expand Up @@ -53,4 +58,7 @@
input:-webkit-autofill:active {
background-color: var(--panel);
}

input[required][pattern] {
}
</style>
21 changes: 21 additions & 0 deletions SvelteApp/src/routes/+error.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script>
import Button from "$lib/components/Button.svelte";
</script>

<div class="error">
<h2>Something went wrong !</h2>
<a href="/"><Button>Come back</Button></a>
</div>

<style>
.error {
margin-top: 100px;
display: flex;
flex-direction: column;
align-items: center;
}

a {
text-decoration: none;
}
</style>
16 changes: 8 additions & 8 deletions dvc.lock
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ stages:
outs:
- path: models/base_rf_model.pkl
hash: md5
md5: d141c79da310be2e3ded5ab8236d42d6
size: 30782445
md5: b9d39c597fcea9393ec7777fd017daf9
size: 34199068
train_tuned_model:
cmd:
- python src/models/train_tuned_model.py
Expand All @@ -130,8 +130,8 @@ stages:
outs:
- path: models/tuned_rf_model.pkl
hash: md5
md5: 6f6044ac2b2b9fa4c3602a3482bb8f52
size: 703151443
md5: a459b715b9b620b9011de68f974b33f6
size: 781267122
predict:
cmd:
- python src/models/predict.py
Expand All @@ -142,12 +142,12 @@ stages:
size: 642401
- path: models/base_rf_model.pkl
hash: md5
md5: d141c79da310be2e3ded5ab8236d42d6
size: 30782445
md5: b9d39c597fcea9393ec7777fd017daf9
size: 34199068
- path: models/tuned_rf_model.pkl
hash: md5
md5: 6f6044ac2b2b9fa4c3602a3482bb8f52
size: 703151443
md5: a459b715b9b620b9011de68f974b33f6
size: 781267122
- path: src/models/predict.py
hash: md5
md5: 422b5f22679fcc6ce1e308524a508457
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
artifact_uri: file:///D:\Ivan\Desktop\lanubile\MalURLs\mlruns/573845569101247538/2d733c79c7e846e3a8f607c7eb922c36/artifacts
end_time: 1702392120653
entry_point_name: ''
experiment_id: '573845569101247538'
lifecycle_stage: active
run_id: 2d733c79c7e846e3a8f607c7eb922c36
run_name: learned-calf-991
run_uuid: 2d733c79c7e846e3a8f607c7eb922c36
source_name: ''
source_type: 4
source_version: ''
start_time: 1702392114802
status: 3
tags: []
user_id: c7191034459c989507c2883aeccd4deae44d935e
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1702392120643 0.8959933435739886 0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1702392120643 0.8961014019589015 0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1702392120643 0.896 0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1702392120643 0.896 0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6308204809a24f518dab580aac29e106
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
learned-calf-991
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6660727774f5652f5414965d4dcba3054a9dec55
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/models/predict.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LOCAL
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c7191034459c989507c2883aeccd4deae44d935e
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
random_forest_tuned_model
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
artifact_uri: file:///D:\Ivan\Desktop\lanubile\MalURLs\mlruns/573845569101247538/6308204809a24f518dab580aac29e106/artifacts
end_time: 1702392120657
entry_point_name: ''
experiment_id: '573845569101247538'
lifecycle_stage: active
run_id: 6308204809a24f518dab580aac29e106
run_name: respected-boar-774
run_uuid: 6308204809a24f518dab580aac29e106
source_name: ''
source_type: 4
source_version: ''
start_time: 1702392114220
status: 3
tags: []
user_id: c7191034459c989507c2883aeccd4deae44d935e
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1702392114538 0.8929922686914129 0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1702392114538 0.8931136098332417 0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1702392114538 0.893 0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1702392114538 0.893 0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
respected-boar-774
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6660727774f5652f5414965d4dcba3054a9dec55
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/models/predict.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LOCAL
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c7191034459c989507c2883aeccd4deae44d935e
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
random_forest_base_model
3 changes: 1 addition & 2 deletions mlruns/models/base_rf_model/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
aliases: {}
creation_timestamp: 1699354056057
description: null
last_updated_timestamp: 1702371461908
name: base_rf_model
last_updated_timestamp: 1702392114620
10 changes: 5 additions & 5 deletions mlruns/models/base_rf_model/version-18/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
aliases: []
creation_timestamp: 1702371461908
creation_timestamp: 1702392114620
current_stage: None
description: null
last_updated_timestamp: 1702371461908
last_updated_timestamp: 1702392114620
name: base_rf_model
run_id: 8b377663ca5b44048b37148730d29b35
run_id: 6308204809a24f518dab580aac29e106
run_link: null
source: file:///D:\Ivan\Desktop\lanubile\MalURLs\mlruns/573845569101247538/8b377663ca5b44048b37148730d29b35/artifacts/models
source: file:///D:\Ivan\Desktop\lanubile\MalURLs\mlruns/573845569101247538/6308204809a24f518dab580aac29e106/artifacts/models
status: READY
status_message: null
storage_location: file:///D:\Ivan\Desktop\lanubile\MalURLs\mlruns/573845569101247538/8b377663ca5b44048b37148730d29b35/artifacts/models
storage_location: file:///D:\Ivan\Desktop\lanubile\MalURLs\mlruns/573845569101247538/6308204809a24f518dab580aac29e106/artifacts/modelsr
user_id: null
version: 18
2 changes: 1 addition & 1 deletion mlruns/models/tuned_rf_model/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
aliases: {}
creation_timestamp: 1699354060301
description: null
last_updated_timestamp: 1702371465095
last_updated_timestamp: 1702392120467
name: tuned_rf_model
10 changes: 5 additions & 5 deletions mlruns/models/tuned_rf_model/version-18/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
aliases: []
creation_timestamp: 1702371465095
creation_timestamp: 1702392120467
current_stage: None
description: null
last_updated_timestamp: 1702371465095
last_updated_timestamp: 1702392120467
name: tuned_rf_model
run_id: a3bb412e26634a0fadfa39f1ffbe7ede
run_id: 2d733c79c7e846e3a8f607c7eb922c36
run_link: null
source: file:///D:\Ivan\Desktop\lanubile\MalURLs\mlruns/573845569101247538/a3bb412e26634a0fadfa39f1ffbe7ede/artifacts/models
source: file:///D:\Ivan\Desktop\lanubile\MalURLs\mlruns/573845569101247538/2d733c79c7e846e3a8f607c7eb922c36/artifacts/models
status: READY
status_message: null
storage_location: file:///D:\Ivan\Desktop\lanubile\MalURLs\mlruns/573845569101247538/a3bb412e26634a0fadfa39f1ffbe7ede/artifacts/models
storage_location: file:///D:\Ivan\Desktop\lanubile\MalURLs\mlruns/573845569101247538/2d733c79c7e846e3a8f607c7eb922c36/artifacts/models
user_id: null
version: 18
22 changes: 22 additions & 0 deletions reports/classification_report_tuned_rf.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
{
"safe_URL": {
"precision": 0.889763779527559,
"recall": 0.904,
"f1-score": 0.8968253968253967,
"support": 2000.0
},
"unsafe_URL": {
"precision": 0.9024390243902439,
"recall": 0.888,
"f1-score": 0.8951612903225806,
"support": 2000.0
},
"accuracy": 0.896,
"macro avg": {
"precision": 0.8961014019589015,
"recall": 0.896,
"f1-score": 0.8959933435739886,
"support": 4000.0
},
"weighted avg": {
"precision": 0.8961014019589015,
"recall": 0.896,
"f1-score": 0.8959933435739886,
"precision": 0.8903638151425762,
"recall": 0.9055,
"f1-score": 0.8978681209717402,
Expand Down
6 changes: 4 additions & 2 deletions reports/codecarbon/base_model_emissions.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
timestamp,project_name,run_id,duration,emissions,emissions_rate,cpu_power,gpu_power,ram_power,cpu_energy,gpu_energy,ram_energy,energy_consumed,country_name,country_iso_code,region,cloud_provider,cloud_region,os,python_version,codecarbon_version,cpu_count,cpu_model,gpu_count,gpu_model,longitude,latitude,ram_total_size,tracking_mode,on_cloud,pue
2023-12-05T18:01:34,base_rf_model,c46da3fa-9c85-44e6-95de-eca42fe48cdd,1.8669397830963133,6.266300476804769e-06,3.3564555930197864e-06,32.5,0.0,2.9810914993286133,1.6854317486286164e-05,0,1.5330381502707269e-06,1.838735563655689e-05,Italy,ITA,apulia,,,Windows-10-10.0.19041-SP0,3.9.2,2.3.2,8,AMD Ryzen 5 3400G with Radeon Vega Graphics,,,16.9325,41.0621,7.949577331542969,machine,N,1.0
2023-12-05T18:01:34,base_rf_model,c46da3fa-9c85-44e6-95de-eca42fe48cdd,1.9606516361236572,6.528570357710387e-06,3.329796195012908e-06,32.5,0.0,2.9810914993286133,1.7559242414103614e-05,0,1.5976980182701556e-06,1.915694043237377e-05,Italy,ITA,apulia,,,Windows-10-10.0.19041-SP0,3.9.2,2.3.2,8,AMD Ryzen 5 3400G with Radeon Vega Graphics,,,16.9325,41.0621,7.949577331542969,machine,N,1.0
2023-12-05T18:01:34,base_rf_model,c46da3fa-9c85-44e6-95de-eca42fe48cdd,1.8669397830963133,6.266300476804769e-06,3.3564555930197864e-06,32.5,0.0,2.9810914993286133,1.6854317486286164e-05,0.0,1.5330381502707269e-06,1.838735563655689e-05,Italy,ITA,apulia,,,Windows-10-10.0.19041-SP0,3.9.2,2.3.2,8,AMD Ryzen 5 3400G with Radeon Vega Graphics,,,16.9325,41.0621,7.949577331542969,machine,N,1.0
2023-12-05T18:01:34,base_rf_model,c46da3fa-9c85-44e6-95de-eca42fe48cdd,1.9606516361236568,6.528570357710387e-06,3.329796195012908e-06,32.5,0.0,2.9810914993286133,1.7559242414103614e-05,0.0,1.5976980182701556e-06,1.915694043237377e-05,Italy,ITA,apulia,,,Windows-10-10.0.19041-SP0,3.9.2,2.3.2,8,AMD Ryzen 5 3400G with Radeon Vega Graphics,,,16.9325,41.0621,7.949577331542969,machine,N,1.0
2023-12-12T15:38:45,base_rf_model,62388ff0-6c32-495b-80ff-6f7ddc761086,2.1587934494018555,7.343837365951208e-06,3.4018249258566128e-06,17.5,7.294195185966311,11.226433753967283,1.0489269428782994e-05,4.370003495999565e-06,6.68992502456869e-06,2.154919794935125e-05,Italy,ITA,apulia,,,Windows-10-10.0.22631-SP0,3.11.2,2.3.2,8,AMD Ryzen 7 3750H with Radeon Vega Mobile Gfx,1.0,1 x NVIDIA GeForce RTX 2060,16.7862,41.0795,29.937156677246094,machine,N,1.0
2023-12-12T15:38:45,base_rf_model,62388ff0-6c32-495b-80ff-6f7ddc761086,2.2081751823425293,7.521202847888703e-06,3.4060716323737866e-06,17.5,14.251318049129138,11.226433753967285,1.0724437899059721e-05,4.553614754000332e-06,6.791593079812894e-06,2.2069645732872946e-05,Italy,ITA,apulia,,,Windows-10-10.0.22631-SP0,3.11.2,2.3.2,8,AMD Ryzen 7 3750H with Radeon Vega Mobile Gfx,1.0,1 x NVIDIA GeForce RTX 2060,16.7862,41.0795,29.937156677246094,machine,N,1.0
Loading