Pavankalyan commited on
Commit
9b3d4f0
1 Parent(s): 8e71032

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -2,15 +2,15 @@ import gradio as gr
2
  import pandas as pd
3
  from load_data import *
4
  import os
5
- os.system("pip install git+https://github.com/openai/whisper.git")
6
- import whisper
7
 
8
- model = whisper.load_model("small")
9
- current_size = 'small'
10
 
11
 
12
  hf_writer = gr.HuggingFaceDatasetSaver('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', "Pavankalyan/chitti_data")
13
-
14
  def inference(audio):
15
  audio = whisper.load_audio(audio)
16
  audio = whisper.pad_or_trim(audio)
@@ -21,8 +21,9 @@ def inference(audio):
21
 
22
  options = whisper.DecodingOptions(fp16 = False)
23
  result = whisper.decode(model, mel, options)
24
-
25
- query = result.text
 
26
  re_table = search(query)
27
  answers_re_table = [re_table[i][0] for i in range(0,5)]
28
  answer_links = [re_table[i][3] for i in range(0,5)]
@@ -40,8 +41,9 @@ def inference(audio):
40
  #return [re_table[0][0],re_table[0][3],re_table[1][0],re_table[1][3]]
41
 
42
  demo = gr.Interface(
43
- fn=inference,
44
- inputs=[gr.inputs.Audio(source="microphone", type="filepath", label="Record your audio")],
 
45
  outputs=["text","text","text","text"],
46
  allow_flagging = "manual",
47
  flagging_options = ["0","1","None"],
 
2
  import pandas as pd
3
  from load_data import *
4
  import os
5
+ #os.system("pip install git+https://github.com/openai/whisper.git")
6
+ #import whisper
7
 
8
+ #model = whisper.load_model("small")
9
+ #current_size = 'small'
10
 
11
 
12
  hf_writer = gr.HuggingFaceDatasetSaver('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', "Pavankalyan/chitti_data")
13
+ '''
14
  def inference(audio):
15
  audio = whisper.load_audio(audio)
16
  audio = whisper.pad_or_trim(audio)
 
21
 
22
  options = whisper.DecodingOptions(fp16 = False)
23
  result = whisper.decode(model, mel, options)
24
+ return result.text
25
+ '''
26
+ def chitti(query):
27
  re_table = search(query)
28
  answers_re_table = [re_table[i][0] for i in range(0,5)]
29
  answer_links = [re_table[i][3] for i in range(0,5)]
 
41
  #return [re_table[0][0],re_table[0][3],re_table[1][0],re_table[1][3]]
42
 
43
  demo = gr.Interface(
44
+ fn=chitti,
45
+ inputs=["text"]
46
+ #inputs=[gr.inputs.Audio(source="microphone", type="filepath", label="Record your audio")],
47
  outputs=["text","text","text","text"],
48
  allow_flagging = "manual",
49
  flagging_options = ["0","1","None"],