ierhon commited on
Commit
0c7b422
1 Parent(s): b9b66d9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +29 -1
README.md CHANGED
@@ -4,4 +4,32 @@ pipeline_tag: conversational
4
  ---
5
 
6
  # Basic chatbot
7
- That is a code for a basic neural network chatbot on keras, feel free to use this code for any chatbots.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  ---
5
 
6
  # Basic chatbot
7
+ That is a code for a basic neural network chatbot on keras, feel free to use this code for any chatbots.
8
+ # How to use
9
+ ## dataset.json & responses.txt
10
+ ### dataset.json
11
+ This is the file for the dataset that the neural network will learn on. Usually the bigger the model and the dataset the better. The dataset in this case has the key, which is the input, and value which is the number of the output line. **Warning** The lines are counting from 0 to n, not from 1 to n. The example is already provided in the files, but here's an example how are you supposed to write it:
12
+ ```json
13
+ {
14
+ "Input1": 0,
15
+ "Hey.": 1
16
+ }
17
+ ```
18
+ ### responses.txt
19
+ This is the file with all the responses this neural network can have. The number of the response is the number of the line it is on (minus one, because in this case lines count from 0). The `responses.txt` example is already provided in the model files but here's an example of how the file is supposed to look like:
20
+ ```txt
21
+ Response1
22
+ Hello.
23
+ ```
24
+ ## train.py
25
+ To start training, use `python3 train.py` in the terminal. By default, it reads a file `dataset.json` in the current directory (you can change it on the line 11). This will save the model to `chatbot.keras`, you can change this on the line 52. **Warning** The model file name should always end with `.keras`, until if it's outdated.
26
+ ## test.py
27
+ To use the model, run `python3 test.py`, it will open a chat to test this bot. To use this chatbot in your code, put the `chatbot.keras` and the `test.py` (it's better to rename it) into your project directory. Then, to use the model, just `import test` or how you named the file, and use `test.generate("text")`. Here's an example of a chat.
28
+ ```py
29
+ import test
30
+
31
+ while True:
32
+ message = input("Message: ")
33
+ response = test.generate(message, verbose=0)
34
+ print(f"Bot: {response}")
35
+ ```