Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -31,14 +31,6 @@ from PyPDF2 import PdfReader
|
|
31 |
from templates import bot_template, css, user_template
|
32 |
from xml.etree import ElementTree as ET
|
33 |
|
34 |
-
# Whisper Constants
|
35 |
-
file_path = 'text_output.txt'
|
36 |
-
WHISPER_API_URL = 'https://tonpixzfvq3791u9.us-east-1.aws.endpoints.huggingface.cloud'
|
37 |
-
WHISPER_headers = {
|
38 |
-
"Authorization": "Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
39 |
-
"Content-Type": "audio/wav"
|
40 |
-
}
|
41 |
-
|
42 |
# Llama Constants
|
43 |
API_URL = 'https://qe55p8afio98s0u3.us-east-1.aws.endpoints.huggingface.cloud' # Dr Llama
|
44 |
API_KEY = os.getenv('API_KEY')
|
@@ -403,6 +395,11 @@ def whisper(filename):
|
|
403 |
except:
|
404 |
st.write(f'Could not open or read {filename}')
|
405 |
#try:
|
|
|
|
|
|
|
|
|
|
|
406 |
response = requests.post(WHISPER_API_URL, headers=WHISPER_headers, data=data)
|
407 |
#except:
|
408 |
# st.write('Whisper Voice Speech to Text Model is asleep. Starting up now on T4 - please give 3 minutes then retry as KEDA scales up from zero to activate running container(s).')
|
@@ -429,6 +426,7 @@ def whisper_transcribe_audio(filename):
|
|
429 |
return output
|
430 |
|
431 |
def whisper_save_transcription(transcription):
|
|
|
432 |
with open(file_path, 'a') as f:
|
433 |
f.write(f"{transcription}\n")
|
434 |
|
|
|
31 |
from templates import bot_template, css, user_template
|
32 |
from xml.etree import ElementTree as ET
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
# Llama Constants
|
35 |
API_URL = 'https://qe55p8afio98s0u3.us-east-1.aws.endpoints.huggingface.cloud' # Dr Llama
|
36 |
API_KEY = os.getenv('API_KEY')
|
|
|
395 |
except:
|
396 |
st.write(f'Could not open or read {filename}')
|
397 |
#try:
|
398 |
+
WHISPER_API_URL = 'https://tonpixzfvq3791u9.us-east-1.aws.endpoints.huggingface.cloud'
|
399 |
+
WHISPER_headers = {
|
400 |
+
"Authorization": "Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
401 |
+
"Content-Type": "audio/wav"
|
402 |
+
}
|
403 |
response = requests.post(WHISPER_API_URL, headers=WHISPER_headers, data=data)
|
404 |
#except:
|
405 |
# st.write('Whisper Voice Speech to Text Model is asleep. Starting up now on T4 - please give 3 minutes then retry as KEDA scales up from zero to activate running container(s).')
|
|
|
426 |
return output
|
427 |
|
428 |
def whisper_save_transcription(transcription):
|
429 |
+
file_path = 'text_output.txt'
|
430 |
with open(file_path, 'a') as f:
|
431 |
f.write(f"{transcription}\n")
|
432 |
|