Commit a2d1b0b7 authored by W.D.R.P. Sandeepa's avatar W.D.R.P. Sandeepa

add main method and client end point

parent 4286abe7
import requests
URL = "http://127.0.0.1:5000/predict"
TEST_AUDIO_FILE_PATH = "test/other.wav"
if __name__ == "__main__":
audio_file = open(TEST_AUDIO_FILE_PATH, "rb")
values = {
"file": (TEST_AUDIO_FILE_PATH, audio_file, "audio/wav")
}
response = requests.post(URL, files=values)
data = response.json()
print(f"Predicted Keyword is : {data['Keyword']}")
\ No newline at end of file
......@@ -32,3 +32,8 @@ def predict():
# send back the predicted keword in json format
data = {"Keyword": predicted_keyword}
return jsonify(data)
if __name__ == "__main__":
# app.run(host='192.168.8.102')
#app.run(host='192.168.8.100,port='5000', debug=True)
app.run(debug=False)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment