camparchimedes commited on
Commit
6d1025b
·
verified ·
1 Parent(s): f89a062

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -3
app.py CHANGED
@@ -6,6 +6,9 @@ import torch
6
  from transformers import WhisperTokenizer, WhisperForConditionalGeneration, WhisperProcessor
7
  import soundfile as sf
8
  import ffmpeg
 
 
 
9
  import spaces
10
 
11
  warnings.filterwarnings("ignore")
@@ -28,7 +31,7 @@ def convert_audio_format(audio_path):
28
  return output_path
29
 
30
 
31
- @spaces.GPU
32
  def transcribe_audio(audio_file, batch_size=4):
33
  audio_path = convert_audio_format(audio_file)
34
  audio_input, sample_rate = sf.read(audio_path)
@@ -52,16 +55,26 @@ def transcribe_audio(audio_file, batch_size=4):
52
 
53
  return transcription.strip()
54
 
55
- # HTML | Banner image
56
  banner_html = """
57
  <div style="text-align: center;">
58
  <img src="https://huggingface.co/spaces/camparchimedes/ola_s-audioshop/raw/main/Olas%20AudioSwitch%20Shop.png" alt="Banner" width="87%" height="auto">
59
  </div>
60
  <div style="text-align: center; margin-top: 20px;">
61
- <img src="https://huggingface.co/spaces/camparchimedes/ola_s-audioshop/raw/main/picture.jpg" alt="image" width="50%" height="auto">
62
  </div>
63
  """
64
 
 
 
 
 
 
 
 
 
 
 
65
  # Gradio interface
66
  iface = gr.Blocks()
67
 
 
6
  from transformers import WhisperTokenizer, WhisperForConditionalGeneration, WhisperProcessor
7
  import soundfile as sf
8
  import ffmpeg
9
+ import os
10
+ from huggingface_hub import InferenceClient
11
+ from gradio_client import Client, file
12
  import spaces
13
 
14
  warnings.filterwarnings("ignore")
 
31
  return output_path
32
 
33
 
34
+ @spaces.GPU(duration=120, queue=False)
35
  def transcribe_audio(audio_file, batch_size=4):
36
  audio_path = convert_audio_format(audio_file)
37
  audio_input, sample_rate = sf.read(audio_path)
 
55
 
56
  return transcription.strip()
57
 
58
+ # HTML
59
  banner_html = """
60
  <div style="text-align: center;">
61
  <img src="https://huggingface.co/spaces/camparchimedes/ola_s-audioshop/raw/main/Olas%20AudioSwitch%20Shop.png" alt="Banner" width="87%" height="auto">
62
  </div>
63
  <div style="text-align: center; margin-top: 20px;">
64
+ <img src="https://huggingface.co/spaces/camparchimedes/ola_s-audioshop/raw/main/picture.jpg" alt="picture" width="50%" height="auto">
65
  </div>
66
  """
67
 
68
+ images_path = os.path.dirname(__file__)
69
+ IMAGES = [
70
+ [
71
+ {
72
+ "text": "What usual stuff happens in this image? :)",
73
+ "files": [f"{images_path}/500x_picture.png"],
74
+ }
75
+ ]
76
+ ]
77
+
78
  # Gradio interface
79
  iface = gr.Blocks()
80