fffiloni commited on
Commit
f22b6e2
β€’
1 Parent(s): 8d13809

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -12
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import gradio as gr
2
  import torch
3
- from datasets import load_dataset
4
- import soundfile as sf
5
  from diffusers import DiffusionPipeline
6
  from transformers import (
7
  WhisperForConditionalGeneration,
@@ -28,14 +27,6 @@ diffuser_pipeline = DiffusionPipeline.from_pretrained(
28
  diffuser_pipeline.enable_attention_slicing()
29
  diffuser_pipeline = diffuser_pipeline.to(device)
30
 
31
- #β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
32
- # TESTING WITH DATASET
33
- ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
34
-
35
- audio_sample = ds[3]
36
-
37
- text = audio_sample["text"].lower()
38
- speech_data = audio_sample["audio"]["array"]
39
 
40
  #β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
41
  # GRADIO SETUP
@@ -61,8 +52,8 @@ def speech_to_text(audio_sample):
61
  β€”β€”β€”β€”β€”β€”β€”β€”
62
  """)
63
 
64
- #output = diffuser_pipeline(audio_sample[1])
65
- output = diffuser_pipeline(speech_data)
66
  print(f"""
67
  β€”β€”β€”β€”β€”β€”β€”β€”
68
  output: {output}
 
1
  import gradio as gr
2
  import torch
3
+
 
4
  from diffusers import DiffusionPipeline
5
  from transformers import (
6
  WhisperForConditionalGeneration,
 
27
  diffuser_pipeline.enable_attention_slicing()
28
  diffuser_pipeline = diffuser_pipeline.to(device)
29
 
 
 
 
 
 
 
 
 
30
 
31
  #β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
32
  # GRADIO SETUP
 
52
  β€”β€”β€”β€”β€”β€”β€”β€”
53
  """)
54
 
55
+ output = diffuser_pipeline(audio_sample[1])
56
+
57
  print(f"""
58
  β€”β€”β€”β€”β€”β€”β€”β€”
59
  output: {output}