awacke1 commited on
Commit
7dc16ed
1 Parent(s): 71ee616

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -388,16 +388,14 @@ def get_zip_download_link(zip_file):
388
  return href
389
 
390
  def whisper(filename):
391
- try:
392
- with open(filename, "rb") as f:
393
- data = f.read
394
- #st.write(data)
395
- except:
396
- st.write(f'Could not open or read {filename}')
397
-
398
-
399
- WHISPER_headers = { "Authorization": "Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","Content-Type": "audio/wav" }
400
- response = requests.post('https://tonpixzfvq3791u9.us-east-1.aws.endpoints.huggingface.cloud', headers=WHISPER_headers, data=data)
401
  st.write(response)
402
  return response.json()
403
 
 
388
  return href
389
 
390
  def whisper(filename):
391
+ with open(filename, "rb") as f:
392
+ data = f.read
393
+ API_URL = f'https://tonpixzfvq3791u9.us-east-1.aws.endpoints.huggingface.cloud'
394
+ headers = {
395
+ "Authorization": "Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
396
+ "Content-Type": "audio/wav"
397
+ }
398
+ response = requests.post(API_URL, headers data)
 
 
399
  st.write(response)
400
  return response.json()
401