import requests

# server url
URL = "http://127.0.0.1:5050/predict"


# audio file send for predicting keyword
FILE_PATH = "audio/fold1/100263-2-0-117.wav"


if __name__ == "__main__":

    # open files
    file = open(FILE_PATH, "rb")

    # package stuff to send and perform POST request
    values = {"file": (FILE_PATH, file, "audio/fold1/100263-2-0-117.wav")}
    response = requests.post(URL, files=values)
    data = response.json()

    print("Predicted keyword: {}".format(data["keyword"]))