Yusin commited on
Commit
9f7fe25
1 Parent(s): ff559bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -57
app.py CHANGED
@@ -20,8 +20,6 @@ def magic_whisper_to_sd(audio, guidance_scale, nb_iterations, seed):
20
 
21
  return whisper_results[0], whisper_results[1], images
22
 
23
-
24
-
25
  def translate_better(audio):
26
  print("""
27
 
@@ -57,18 +55,6 @@ with gr.Blocks() as demo:
57
  audio_r_translate = gr.Button("Check Whisper first ? 👍", elem_id="check_btn_1")
58
  audio_r_direct_sd = gr.Button("Magic Whisper › SD right now!", elem_id="magic_btn_1")
59
 
60
- with gr.Tab(label="Upload audio input", elem_id="upload_tab"):
61
- with gr.Column():
62
- upload_input = gr.Audio(
63
- source="upload",
64
- type="filepath",
65
- show_label=False,
66
- elem_id="upload_area"
67
- )
68
- with gr.Row():
69
- audio_u_translate = gr.Button("Check Whisper first ? 👍", elem_id="check_btn_2")
70
- audio_u_direct_sd = gr.Button("Magic Whisper › SD right now!", elem_id="magic_btn_2")
71
-
72
  with gr.Accordion(label="Stable Diffusion Settings", elem_id="sd_settings", visible=False):
73
  with gr.Row():
74
  guidance_scale = gr.Slider(2, 15, value = 7, label = 'Guidance Scale')
@@ -82,27 +68,21 @@ with gr.Blocks() as demo:
82
  )
83
 
84
  with gr.Row():
85
-
86
  transcripted_output = gr.Textbox(
87
  label="Transcription in your detected spoken language",
88
  lines=3,
89
  elem_id="transcripted"
90
  )
91
- #language_detected_output = gr.Textbox(label="Native language", elem_id="spoken_lang",lines=3)
92
-
93
- with gr.Column():
94
  translated_output = gr.Textbox(
95
- label="Transcript translated in English by Whisper",
96
- lines=4,
97
  elem_id="translated"
98
  )
99
  with gr.Row():
100
  clear_btn = gr.Button(value="Clear")
101
  diffuse_btn = gr.Button(value="OK, Diffuse this prompt !", elem_id="diffuse_btn")
102
-
103
  clear_btn.click(fn=lambda value: gr.update(value=""), inputs=clear_btn, outputs=translated_output)
104
-
105
-
106
 
107
  gr.Markdown("""
108
  ## 3. Wait for Stable Diffusion Results ☕️
@@ -111,24 +91,6 @@ with gr.Blocks() as demo:
111
  )
112
 
113
  sd_output = gr.Gallery().style(grid=2, height="auto")
114
-
115
-
116
- audio_r_translate.click(translate_better,
117
- inputs = record_input,
118
- outputs = [
119
- #language_detected_output,
120
- transcripted_output,
121
- translated_output
122
- ])
123
-
124
- audio_u_translate.click(translate_better,
125
- inputs = upload_input,
126
- outputs = [
127
- #language_detected_output,
128
- transcripted_output,
129
- translated_output
130
- ])
131
-
132
  audio_r_direct_sd.click(magic_whisper_to_sd,
133
  inputs = [
134
  record_input,
@@ -137,26 +99,10 @@ with gr.Blocks() as demo:
137
  seed
138
  ],
139
  outputs = [
140
- #language_detected_output,
141
  transcripted_output,
142
  translated_output,
143
  sd_output
144
  ])
145
-
146
- audio_u_direct_sd.click(magic_whisper_to_sd,
147
- inputs = [
148
- upload_input,
149
- guidance_scale,
150
- nb_iterations,
151
- seed
152
- ],
153
- outputs = [
154
- #language_detected_output,
155
- transcripted_output,
156
- translated_output,
157
- sd_output
158
- ])
159
-
160
  diffuse_btn.click(get_images,
161
  inputs = [
162
  translated_output
 
20
 
21
  return whisper_results[0], whisper_results[1], images
22
 
 
 
23
  def translate_better(audio):
24
  print("""
25
 
 
55
  audio_r_translate = gr.Button("Check Whisper first ? 👍", elem_id="check_btn_1")
56
  audio_r_direct_sd = gr.Button("Magic Whisper › SD right now!", elem_id="magic_btn_1")
57
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  with gr.Accordion(label="Stable Diffusion Settings", elem_id="sd_settings", visible=False):
59
  with gr.Row():
60
  guidance_scale = gr.Slider(2, 15, value = 7, label = 'Guidance Scale')
 
68
  )
69
 
70
  with gr.Row():
 
71
  transcripted_output = gr.Textbox(
72
  label="Transcription in your detected spoken language",
73
  lines=3,
74
  elem_id="transcripted"
75
  )
 
 
 
76
  translated_output = gr.Textbox(
77
+ label="Transcription in your detected spoken language",
78
+ lines=3,
79
  elem_id="translated"
80
  )
81
  with gr.Row():
82
  clear_btn = gr.Button(value="Clear")
83
  diffuse_btn = gr.Button(value="OK, Diffuse this prompt !", elem_id="diffuse_btn")
 
84
  clear_btn.click(fn=lambda value: gr.update(value=""), inputs=clear_btn, outputs=translated_output)
85
+
 
86
 
87
  gr.Markdown("""
88
  ## 3. Wait for Stable Diffusion Results ☕️
 
91
  )
92
 
93
  sd_output = gr.Gallery().style(grid=2, height="auto")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  audio_r_direct_sd.click(magic_whisper_to_sd,
95
  inputs = [
96
  record_input,
 
99
  seed
100
  ],
101
  outputs = [
 
102
  transcripted_output,
103
  translated_output,
104
  sd_output
105
  ])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  diffuse_btn.click(get_images,
107
  inputs = [
108
  translated_output