This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 355
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a flag to specify the intents file, fixes #70
- Loading branch information
Showing
7 changed files
with
38 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,35 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/gookit/color" | ||
|
||
"github.com/olivia-ai/olivia/network" | ||
|
||
"github.com/olivia-ai/olivia/server" | ||
"github.com/olivia-ai/olivia/training" | ||
) | ||
|
||
var ( | ||
// Initialize the neural network by training it | ||
neuralNetwork = training.CreateNeuralNetwork() | ||
) | ||
var neuralNetwork network.Network | ||
|
||
func main() { | ||
intentsPath := flag.String("intents", "res/intents.json", "The path for intents file.") | ||
flag.Parse() | ||
|
||
magenta := color.FgMagenta.Render | ||
fmt.Printf("Using %s as intents file.\n", magenta(*intentsPath)) | ||
|
||
neuralNetwork = training.CreateNeuralNetwork(*intentsPath) | ||
|
||
port := "8080" | ||
// Get port from environment variables if there is | ||
if os.Getenv("PORT") != "" { | ||
port = os.Getenv("PORT") | ||
} | ||
|
||
// Serves the server | ||
server.Serve(neuralNetwork, port) | ||
server.Serve(neuralNetwork, port, *intentsPath) | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters