pierrelf Emil Karlsson commited on
Commit
e357f89
·
1 Parent(s): d4e93ec

Restore base functionality

Browse files

Co-authored-by: Emil Karlsson <own.emka@gmail.com>

Files changed (2) hide show
  1. .gitignore +2 -1
  2. app.py +9 -14
.gitignore CHANGED
@@ -1 +1,2 @@
1
- flagged
 
 
1
+ flagged
2
+ __pycache__
app.py CHANGED
@@ -1,29 +1,24 @@
1
  from transformers import pipeline
2
  import gradio as gr
3
- import torch
4
 
5
- def detect_gpu():
6
- if not torch.cuda.is_available():
7
- print("No GPU device found")
8
- exit()
9
-
10
- print(f"Found {torch.cuda.device_count()} GPU device(s)")
11
- print(f"Using {torch.cuda.get_device_name(0)}")
12
-
13
- detect_gpu()
14
 
15
- pipe = pipeline(model="pierrelf/whisper-small-sv", device=0)
16
 
17
  def transcribe(audio):
18
  text = pipe(audio)["text"]
19
  return text
20
 
 
21
  iface = gr.Interface(
22
  fn=transcribe,
23
- inputs=gr.Audio(sources=['upload', 'microphone'], type="filepath"),
24
- outputs="text",
25
  title="Whisper Swedish",
26
  description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",
27
  )
28
 
29
- iface.launch(server_name="0.0.0.0")
 
 
 
 
 
1
  from transformers import pipeline
2
  import gradio as gr
 
3
 
4
+ pipe = pipeline(model="pierrelf/whisper-small-sv")
 
 
 
 
 
 
 
 
5
 
 
6
 
7
  def transcribe(audio):
8
  text = pipe(audio)["text"]
9
  return text
10
 
11
+
12
  iface = gr.Interface(
13
  fn=transcribe,
14
+ inputs=gr.Audio(sources=["upload", "microphone"], type="filepath"),
15
+ outputs=gr.Text(label="Model output"),
16
  title="Whisper Swedish",
17
  description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",
18
  )
19
 
20
+
21
+ iface.launch(
22
+ server_name="0.0.0.0",
23
+ share=False,
24
+ )