Views
No views yet
1import requests
2
3API_URL = "https://api-inference.huggingface.co/models/YOUR_USERNAME/sinama-translator"
4headers = {"Authorization": "Bearer hf_YOUR_TOKEN"}
5
6with open("audio.wav", "rb") as f:
7 response = requests.post(API_URL, headers=headers, data=f.read())
8
9print(response.json())
10# [{"label": "ako", "score": 0.95}, ...]1import tensorflow as tf, json, librosa, numpy as np
2
3model = tf.keras.models.load_model("best_model.keras")
4with open("label_map.json") as f:
5 label_map = {int(k): v for k, v in json.load(f).items()}
6
7# preprocess your audio the same way as training …
8pred = model.predict(features)
9print(label_map[pred.argmax()])