mirror of
https://github.com/macaodha/batdetect2.git
synced 2025-06-29 14:41:58 +02:00
Update README.md
Added section for using the API with HTTP.
This commit is contained in:
parent
42a838e9f2
commit
d3747c57f2
20
README.md
20
README.md
@ -96,6 +96,26 @@ detections, features = api.process_spectrogram(spec)
|
||||
|
||||
You can integrate the detections or the extracted features to your custom analysis pipeline.
|
||||
|
||||
#### Using the Python API with HTTP
|
||||
|
||||
```python
|
||||
from batdetect2 import api
|
||||
import io
|
||||
import requests
|
||||
|
||||
AUDIO_URL = "<insert your audio url here>"
|
||||
|
||||
# Process a whole file
|
||||
results = api.process_url(AUDIO_URL)
|
||||
|
||||
# Or, load audio and compute spectrograms
|
||||
audio = api.load_audio(io.BytesIO(requests.get(AUDIO_URL).content))
|
||||
spec = api.generate_spectrogram(audio)
|
||||
|
||||
# And process the audio or the spectrogram with the model
|
||||
detections, features, spec = api.process_audio(audio)
|
||||
detections, features = api.process_spectrogram(spec)
|
||||
```
|
||||
|
||||
## Training the model on your own data
|
||||
Take a look at the steps outlined in finetuning readme [here](batdetect2/finetune/readme.md) for a description of how to train your own model.
|
||||
|
Loading…
Reference in New Issue
Block a user