Skip to content
This repository has been archived by the owner on Aug 11, 2023. It is now read-only.

Commit

Permalink
Add ML
Browse files Browse the repository at this point in the history
  • Loading branch information
RealHinome authored Aug 11, 2023
1 parent 5a47898 commit d476c52
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions helpers/verificator.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package helpers

import (
tf "github.com/galeone/tensorflow/tensorflow/go"

Check failure on line 4 in helpers/verificator.go

View workflow job for this annotation

GitHub Actions / build

no required module provides package github.com/galeone/tensorflow/tensorflow/go; to add it:
tg "github.com/galeone/tfgo"

Check failure on line 5 in helpers/verificator.go

View workflow job for this annotation

GitHub Actions / build

no required module provides package github.com/galeone/tfgo; to add it:
)

// CheckHTML uses machine learning to detect fake
// websites such as pishing ones
func CheckHTML(html string) float32 {
model := tg.LoadModel("models/phishing", []string{"serve"}, nil)

input, _ := tf.NewTensor(html)

results := model.Exec([]tf.Output{
model.Op("StatefulPartitionedCall", 0),
}, map[tf.Output]*tf.Tensor{
model.Op("serving_default_inputs_input", 0): input,
})

return results[0].Value().(float32)
}

0 comments on commit d476c52

Please sign in to comment.