Skip to content

Commit

Permalink
Update python.md in docs.
Browse files Browse the repository at this point in the history
Signed-off-by: xAsiimov <admin@xasiimov.com>
  • Loading branch information
xAsiimov committed Aug 3, 2019
1 parent 3c899b5 commit 429ef49
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions docs/quick start/python.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Python Library Quick Start
# Python Library Quick Start

Animius makes it easy for developers to learn and use our python API to create their own virtual assistants.

Expand Down Expand Up @@ -121,12 +121,14 @@ Congrats! Our model performs as well as we imagined before.
Now, it's time to save it into your disk so that you can retrieve it whenever you want.

```
myIntentModel.save(directory='Animius', name='myIntentNER')
myIntentModel.save(directory='/resource/models/myIntentNER', name='myIntentNER')
```

## Setup SpeakerVerification Model

Now, as a crucial step to build our own virtual assistant, let's create a SpeakerVerification Model which could verify speakers of audio clips.
In order to the sentences of specific character, we could train a SpeakerVerification Model.

Thus, you only need to label a few audio slices and let the model automatically detect the others.

### Parse Subtitle

Expand All @@ -140,6 +142,14 @@ parser.load('Animius Violet Evergarden\\01 jp.ass')
parser.slice_audio('Animius Violet Evergarden\\01.mp3', 'Animius Violet Evergarden\\01_slices')
```

### Label audio slices

Next, create two text files: '01 true.txt' and '01 false.txt'.

In '01 true.txt', you should add several paths to audio slices which are the voice of the character you selected.

In '01 false.txt', you should add several paths to audio slices which are not the voice of the character you selected.

### Create model

Simply following the steps of creating IntentNER model as we mentioned above.
Expand All @@ -165,7 +175,24 @@ mySpeakerVerificationModel.init_tensorflow()
mySpeakerVerificationModel.train()
mySpeakerVerificationModel.save(r'SpeakerVerification')
mySpeakerVerificationModel.save(r'resources/models/speaker_verification')
```

### Predict

```
sv_data = am.SpeakerVerificationData()
sv_data.add_text_file('resources/Violet_Evergarden/true.txt', is_speaker=True)
sv_data.add_text_file('resources/Violet_Evergarden/false.txt', is_speaker=False)
sv_model = am.Model.load(r'resources/models/speaker_verification', data=sv_data)
sv_data.add_folder('resources/Violet_Evergarden/slices/01/', is_speaker=None)
result = sv_model.predict(sv_data, save_path='resources/Violet_Evergarden/results/01_result.txt')
```

## Setup Chatbot Model
Expand Down

0 comments on commit 429ef49

Please sign in to comment.