Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -88,7 +88,43 @@ model = WhisperModel(model_size, device="cpu", compute_type="int8") # , compute_
|
|
88 |
# LOADING OF model = WhisperModel(model_size, device="cpu") TAKES ABOUT 1 MINUTE ON HF SPACES STREAMLIT FREE TIER
|
89 |
#
|
90 |
st.write("Ready Loading the WhisperModel: model = WhisperModel(model_size, device=\"cpu\", compute_type=\"int8\")")
|
91 |
-
# LOADING OF model = WhisperModel(model_size, device=\"cpu\", compute_type=\"int8\") TAKES ABOUT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
|
94 |
###########################################################################################################
|
|
|
88 |
# LOADING OF model = WhisperModel(model_size, device="cpu") TAKES ABOUT 1 MINUTE ON HF SPACES STREAMLIT FREE TIER
|
89 |
#
|
90 |
st.write("Ready Loading the WhisperModel: model = WhisperModel(model_size, device=\"cpu\", compute_type=\"int8\")")
|
91 |
+
# LOADING OF model = WhisperModel(model_size, device=\"cpu\", compute_type=\"int8\") TAKES ABOUT 33 sec (Na RERUN 1 minute) ON HF SPACES STREAMLIT FREE TIER
|
92 |
+
|
93 |
+
|
94 |
+
# USING:
|
95 |
+
# model = WhisperModel(model_size, device="cpu", compute_type="int8") # JB
|
96 |
+
# segments, info = model.transcribe("sam_altman_lex_podcast_367.flac", beam_size=1)
|
97 |
+
# /content/Ukrainian podcast #10 Traveling to Lviv - Подорож до Льова. SLOW UKRAINIAN.mp3
|
98 |
+
segments, info = model.transcribe("Ukrainian podcast #10 Traveling to Lviv - Подорож до Льова. SLOW UKRAINIAN.mp3", beam_size=1)
|
99 |
+
# print("Detected language '%s' with probability %f" % (info.language, info.language_probability))
|
100 |
+
st.write("Detected language '%s' with probability %f" % (info.language, info.language_probability))
|
101 |
+
st.write("")
|
102 |
+
st.write("info.all_language_probs : ", info.all_language_probs)
|
103 |
+
st.write("len(info.all_language_probs): ", len(info.all_language_probs))
|
104 |
+
# 99
|
105 |
+
|
106 |
+
st.write("")
|
107 |
+
|
108 |
+
st.write("info: ", info)
|
109 |
+
|
110 |
+
# Ukrainian podcast #10 Traveling to Lviv - Подорож до Льова. SLOW UKRAINIAN.mp3 :
|
111 |
+
st.write("info.duration: ", info.duration)
|
112 |
+
# 233.8249375
|
113 |
+
# time: 3.98 ms (started: 2024-03-15 10:55:15 +00:00)
|
114 |
+
minutes = int(233.8249375 / 60)
|
115 |
+
seconds = 233.8249375 - minutes*60
|
116 |
+
st.write(minutes," minutes and ", seconds, " seconds")
|
117 |
+
|
118 |
+
|
119 |
+
for segment in segments:
|
120 |
+
# print("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text))
|
121 |
+
st.write("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text))
|
122 |
+
|
123 |
+
st.write("---------------------------------------------------------------------")
|
124 |
+
|
125 |
+
for segment in segments:
|
126 |
+
st.write(segment.text)
|
127 |
+
# print(segment)
|
128 |
|
129 |
|
130 |
###########################################################################################################
|