juan-op commited on
Commit
b8a736d
·
1 Parent(s): 6213c40

Specified that fp16 should not be used

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +1 -3
README.md CHANGED
@@ -6,7 +6,7 @@ colorTo: gray
6
  sdk: gradio
7
  sdk_version: 3.16.0
8
  app_file: app.py
9
- pinned: false
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
6
  sdk: gradio
7
  sdk_version: 3.16.0
8
  app_file: app.py
9
+ pinned: true
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py CHANGED
@@ -23,7 +23,7 @@ def download_audio(url: str, path: str) -> None:
23
  def transcribe(path: str) -> List[str]:
24
  """Transcribes the audio file at the given path and returns the text."""
25
  model = whisper.load_model("tiny")
26
- transcription = model.transcribe(path)["text"]
27
  transcription_chunks = [transcription[i : i + 1000] for i in range(0, len(transcription), 1000)]
28
  return transcription_chunks
29
 
@@ -42,7 +42,6 @@ def execute_pipeline(url: str) -> str:
42
  download_audio(url, tmp_dir)
43
  result = transcribe(f"{tmp_dir}/a.mp4")
44
  text = summarize(result)
45
- print("Done!")
46
  return text
47
 
48
 
@@ -57,7 +56,6 @@ def main() -> None:
57
  summarize_btn.click(fn=get_title, inputs=url, outputs=title)
58
  summarize_btn.click(fn=execute_pipeline, inputs=url, outputs=output)
59
  gr.Markdown("*Works best with videos under 10 minutes. It usually takes around 2-3 minutes to execute.*")
60
-
61
  page.launch()
62
 
63
 
 
23
  def transcribe(path: str) -> List[str]:
24
  """Transcribes the audio file at the given path and returns the text."""
25
  model = whisper.load_model("tiny")
26
+ transcription = model.transcribe(path, fp16=False)["text"]
27
  transcription_chunks = [transcription[i : i + 1000] for i in range(0, len(transcription), 1000)]
28
  return transcription_chunks
29
 
 
42
  download_audio(url, tmp_dir)
43
  result = transcribe(f"{tmp_dir}/a.mp4")
44
  text = summarize(result)
 
45
  return text
46
 
47
 
 
56
  summarize_btn.click(fn=get_title, inputs=url, outputs=title)
57
  summarize_btn.click(fn=execute_pipeline, inputs=url, outputs=output)
58
  gr.Markdown("*Works best with videos under 10 minutes. It usually takes around 2-3 minutes to execute.*")
 
59
  page.launch()
60
 
61