mskov commited on
Commit
427b3c7
·
1 Parent(s): 708f4c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -1,5 +1,7 @@
1
  import gradio as gr
2
  from transformers import pipeline
 
 
3
 
4
  title = "Zero-Shot Text Classification with Hugging Face"
5
  description = "bart-large-mnli"
@@ -7,6 +9,18 @@ description = "bart-large-mnli"
7
  classifier = pipeline("zero-shot-classification",
8
  model="facebook/bart-large-mnli")
9
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  #define a function to process your input and output
11
  def zero_shot(doc, candidates):
12
  given_labels = candidates.split(", ")
 
1
  import gradio as gr
2
  from transformers import pipeline
3
+ import whisper
4
+
5
 
6
  title = "Zero-Shot Text Classification with Hugging Face"
7
  description = "bart-large-mnli"
 
9
  classifier = pipeline("zero-shot-classification",
10
  model="facebook/bart-large-mnli")
11
 
12
+ # whisper model specification
13
+ asr_model = whisper.load_model("tiny")
14
+
15
+ openai.api_key = os.environ["Openai_APIkey"]
16
+
17
+
18
+ # Transcribe function
19
+ def transcribe(audio_file):
20
+ print("Transcribing")
21
+ transcription = asr_model.transcribe(audio_file)["text"]
22
+ return transcription
23
+
24
  #define a function to process your input and output
25
  def zero_shot(doc, candidates):
26
  given_labels = candidates.split(", ")