Spaces:
Sleeping
Sleeping
change transcript to gradio
Browse files
libs/transformer/get_transcript_gradio_api.py
CHANGED
@@ -11,3 +11,5 @@ def api_gradio_transcribe(url: str):
|
|
11 |
|
12 |
return result
|
13 |
|
|
|
|
|
|
11 |
|
12 |
return result
|
13 |
|
14 |
+
print(api_gradio_transcribe("https://static.langkingdom.com/user_playlist_practice_videos/937f2c1558c92a0ea81a6778c8426044.mov"))
|
15 |
+
|
routers/get_transcript_gradio.py
CHANGED
@@ -27,7 +27,8 @@ def get_transcript(audio_path: str, model_size: str = "distil-whisper/distil-sma
|
|
27 |
# convert_to_audio(audio_path.strip(), output_file)
|
28 |
|
29 |
try:
|
30 |
-
text, chunks = open_ai_whisper_api(audio_path)
|
|
|
31 |
|
32 |
except Exception as error:
|
33 |
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail=f"error>>>: {error}")
|
@@ -37,12 +38,12 @@ def get_transcript(audio_path: str, model_size: str = "distil-whisper/distil-sma
|
|
37 |
|
38 |
listSentences = []
|
39 |
|
40 |
-
for chunk in chunks:
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
|
47 |
et = time.time()
|
48 |
|
|
|
27 |
# convert_to_audio(audio_path.strip(), output_file)
|
28 |
|
29 |
try:
|
30 |
+
# text, chunks = open_ai_whisper_api(audio_path)
|
31 |
+
text = api_gradio_transcribe(audio_path)
|
32 |
|
33 |
except Exception as error:
|
34 |
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail=f"error>>>: {error}")
|
|
|
38 |
|
39 |
listSentences = []
|
40 |
|
41 |
+
# for chunk in chunks:
|
42 |
+
# listSentences.append({
|
43 |
+
# "start_time": chunk.get("timestamp")[0],
|
44 |
+
# "end_time": chunk.get("timestamp")[1],
|
45 |
+
# "text": chunk.get("text")
|
46 |
+
# })
|
47 |
|
48 |
et = time.time()
|
49 |
|