herrDeng網內搜尋

自訂搜尋

Ads

2023年4月13日 星期四

Openai whisper超好用第2集---Google Colab python cuda語音辨識程式產生字幕檔

 
 Code在下面: Openai whisper超好用第2集---Google Colab python cuda語音辨識程式產生字幕檔, 用過其他語音辨識軟體的,比較openai-whisper,就知道實在太強了。最近補上影片字幕就是是用openai-whisper產生的,語音辨識錯誤率低沒有用到多少工人智慧。這個絕招老師不藏私!!!老師也試用替德語影片上德文字幕,效果也非常好,中文字幕就用chatGPT翻譯。這種AI應用功能強大到讓人皮皮挫!!! [電影丈量世界Vermessung der Welt神童高斯解答片段]https://youtu.be/zQRzKmPxUQo 
[openai-whisper超好用[第一集]---簡介與python pytube語音前置處理]https://youtu.be/sunkO4vCmsQ 
[100%C++ 解答LeetCode 122 Best Time to Buy and Sell Stock 2]https://youtu.be/sJd7Q0HyyRg  
「openai dall-e python ai修圖」https://youtu.be/H843f1MY_gc 
「opencv使用setMouseCallback, circle塗鴉」https://www.youtube.com/watch?v=H_Wj6DoHJ3A
「python撰寫使用openai api DALL-E產生黑柴AI假圖」https://youtu.be/R2ufTfQR348 
「與chatGPT對話python的字典dict並解LeetCode 1 Two sum」https://youtu.be/L5Y0GiL78ro
================================
要先安裝 openai-whisper,上傳聲音檔
  1. print('第一步就是要先切到GPU加速->連線->變更執行階段類型')
  2. !nvidia-smi
  3. !pip install -U openai-whisper
  4. !ls
  5. from google.colab import files
  6. uploaded = files.upload()
  7. for fn in uploaded.keys():
  8. print('User uploaded file "{name}" with length {length} bytes'.format(
  9. name=fn, length=len(uploaded[fn])))
  10. x=fn
  11. x
開始下載model檔,然後辨識
  1. import whisper
  2. model=whisper.load_model('large-v2')
  3. result=model.transcribe(x)
  4. result['text']
  5. #result
  6. for key, value in result.items():
  7. print(key, ':', value)
產生字幕檔
  1. from whisper.utils import get_writer
  2. w=get_writer('srt','.')
  3. w(result,'L.srt')
  1. files.download('L.srt')
  2. !cat L.srt

沒有留言:

Related Posts Plugin for WordPress, Blogger...

熱門文章