vineelpratap commited on
Commit
0f191f9
1 Parent(s): 4cba436

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -24
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import gradio as gr
2
- from zeroshot import process, ZS_EXAMPLES
3
 
4
  with gr.Blocks(css="style.css") as demo:
5
  gr.Markdown(
@@ -21,30 +21,54 @@ with gr.Blocks(css="style.css") as demo:
21
  "The following parameters are used for beam-search decoding. Use the default values if you are not sure."
22
  )
23
  with gr.Row():
24
- wscore = gr.Slider(
25
- minimum=-10.0,
26
- maximum=10.0,
27
- value=0,
28
- step=0.1,
29
- interactive=True,
30
- label="Word Insertion Score",
31
- )
32
- lmscore = gr.Slider(
33
- minimum=-10.0,
34
- maximum=10.0,
35
- value=0,
36
- step=0.1,
37
- interactive=True,
38
- label="Language Model Score",
39
- )
40
- with gr.Row():
41
- wscore_usedefault = gr.Checkbox(
42
- label="Use Default Word Insertion Score", value=True
43
- )
44
- lmscore_usedefault = gr.Checkbox(
45
- label="Use Default Language Model Score", value=True
46
- )
 
 
47
  btn = gr.Button("Submit", elem_id="submit")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  with gr.Column():
49
  text = gr.Textbox(label="Transcript")
50
  btn.click(
 
1
  import gradio as gr
2
+ from zeroshot import process, ZS_EXAMPLES, WORD_SCORE_DEFAULT_IF_LM, WORD_SCORE_DEFAULT_IF_NOLM, LM_SCORE_DEFAULT
3
 
4
  with gr.Blocks(css="style.css") as demo:
5
  gr.Markdown(
 
21
  "The following parameters are used for beam-search decoding. Use the default values if you are not sure."
22
  )
23
  with gr.Row():
24
+ with gr.Column():
25
+ wscore_usedefault = gr.Checkbox(
26
+ label="Use Default Word Insertion Score", value=True
27
+ )
28
+ wscore = gr.Slider(
29
+ minimum=-10.0,
30
+ maximum=10.0,
31
+ value=WORD_SCORE_DEFAULT_IF_NOLM,
32
+ step=0.1,
33
+ interactive=False,
34
+ label="Word Insertion Score",
35
+ )
36
+
37
+ with gr.Column():
38
+ lmscore_usedefault = gr.Checkbox(
39
+ label="Use Default Language Model Score", value=True
40
+ )
41
+ lmscore = gr.Slider(
42
+ minimum=-10.0,
43
+ maximum=10.0,
44
+ value=0,
45
+ step=0.1,
46
+ interactive=False,
47
+ label="Language Model Score",
48
+ )
49
  btn = gr.Button("Submit", elem_id="submit")
50
+
51
+ @gr.on(inputs=[wscore_usedefault, lmscore_usedefault, lm_file], outputs=[wscore, lmscore])
52
+ def update_slider(ws, ls, lm ):
53
+
54
+ ws_slider = gr.Slider(
55
+ minimum=-10.0,
56
+ maximum=10.0,
57
+ value=LM_SCORE_DEFAULT if lm is not None else 0,
58
+ step=0.1,
59
+ interactive=not ws,
60
+ label="Word Insertion Score",
61
+ )
62
+ ls_slider = gr.Slider(
63
+ minimum=-10.0,
64
+ maximum=10.0,
65
+ value=WORD_SCORE_DEFAULT_IF_NOLM if lm is None else WORD_SCORE_DEFAULT_IF_LM,
66
+ step=0.1,
67
+ interactive=not ls,
68
+ label="Language Model Score",
69
+ )
70
+ return ws_slider, ls_slider
71
+
72
  with gr.Column():
73
  text = gr.Textbox(label="Transcript")
74
  btn.click(