YuhangDeng123 commited on
Commit
817bb9d
β€’
1 Parent(s): 5819200

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -22,7 +22,7 @@ def transcribe(audio):
22
 
23
  def DownloadFile(mp3_url):
24
  file_name = 'test.mp3'
25
- res = requests.get(mp3_url)
26
  music = res.content
27
  # θŽ·ε–ζ–‡δ»Άεœ°ε€
28
  file_path = os.path.join(os.getcwd(), file_name)
@@ -43,6 +43,7 @@ def url_transcribe(url):
43
  path_wav = convert_to_wav(path)
44
  audio_dataset = Dataset.from_dict({"audio": [path_wav]}).cast_column("audio", Audio(sampling_rate=16000))
45
  text = pipe(audio_dataset["audio"])
 
46
  return text[0]["text"]
47
 
48
 
 
22
 
23
  def DownloadFile(mp3_url):
24
  file_name = 'test.mp3'
25
+ res = requests.get(mp3_url + "?raw=true")
26
  music = res.content
27
  # θŽ·ε–ζ–‡δ»Άεœ°ε€
28
  file_path = os.path.join(os.getcwd(), file_name)
 
43
  path_wav = convert_to_wav(path)
44
  audio_dataset = Dataset.from_dict({"audio": [path_wav]}).cast_column("audio", Audio(sampling_rate=16000))
45
  text = pipe(audio_dataset["audio"])
46
+ os.remove(path)
47
  return text[0]["text"]
48
 
49