sasha HF staff commited on
Commit
f0fb260
Β·
1 Parent(s): 6be235b

Update app.py

Browse files

making insect change

Files changed (1) hide show
  1. app.py +25 -19
app.py CHANGED
@@ -12,7 +12,7 @@ import os
12
  stable_diffusion = gr.Blocks.load(name="spaces/stabilityai/stable-diffusion")
13
  ### β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
14
 
15
- title="Whisper to Stable Diffusion"
16
 
17
  ### β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
18
 
@@ -274,15 +274,17 @@ with gr.Blocks(css=css) as demo:
274
  with gr.Column():
275
  gr.HTML('''
276
  <h1>
277
- Whisper to Stable Diffusion
 
278
  </h1>
279
  <p style='text-align: center;'>
280
- Ask stable diffusion for images by speaking (or singing πŸ€—) in your native language ! Try it in French πŸ˜‰
 
281
  </p>
282
 
283
  <p style='text-align: center;'>
284
- This demo is wired to the official SD Space β€’ Offered by Sylvain <a href='https://twitter.com/fffiloni' target='_blank'>@fffiloni</a> β€’ <img id='visitor-badge' alt='visitor badge' src='https://visitor-badge.glitch.me/badge?page_id=gradio-blocks.whisper-to-stable-diffusion' style='display: inline-block' /><br />
285
- β€”
286
  </p>
287
 
288
  ''')
@@ -292,11 +294,12 @@ with gr.Blocks(css=css) as demo:
292
  gr.Markdown(
293
  """
294
 
295
- ## 1. Record audio or Upload an audio file:
 
296
  """
297
  )
298
 
299
- with gr.Tab(label="Record audio input", elem_id="record_tab"):
300
  with gr.Column():
301
  record_input = gr.Audio(
302
  source="microphone",
@@ -305,10 +308,10 @@ with gr.Blocks(css=css) as demo:
305
  elem_id="record_btn"
306
  )
307
  with gr.Row():
308
- audio_r_translate = gr.Button("Check Whisper first ? πŸ‘", elem_id="check_btn_1")
309
- audio_r_direct_sd = gr.Button("Magic Whisper β€Ί SD right now!", elem_id="magic_btn_1")
310
 
311
- with gr.Tab(label="Upload audio input", elem_id="upload_tab"):
312
  with gr.Column():
313
  upload_input = gr.Audio(
314
  source="upload",
@@ -317,10 +320,10 @@ with gr.Blocks(css=css) as demo:
317
  elem_id="upload_area"
318
  )
319
  with gr.Row():
320
- audio_u_translate = gr.Button("Check Whisper first ? πŸ‘", elem_id="check_btn_2")
321
- audio_u_direct_sd = gr.Button("Magic Whisper β€Ί SD right now!", elem_id="magic_btn_2")
322
 
323
- with gr.Accordion(label="Stable Diffusion Settings", elem_id="sd_settings", visible=False):
324
  with gr.Row():
325
  guidance_scale = gr.Slider(2, 15, value = 7, label = 'Guidance Scale')
326
  nb_iterations = gr.Slider(10, 50, value = 25, step = 1, label = 'Steps')
@@ -328,14 +331,14 @@ with gr.Blocks(css=css) as demo:
328
 
329
  gr.Markdown(
330
  """
331
- ## 2. Check Whisper output, correct it if necessary:
332
  """
333
  )
334
 
335
  with gr.Row():
336
 
337
  transcripted_output = gr.Textbox(
338
- label="Transcription in your detected spoken language",
339
  lines=3,
340
  elem_id="transcripted"
341
  )
@@ -343,13 +346,13 @@ with gr.Blocks(css=css) as demo:
343
 
344
  with gr.Column():
345
  translated_output = gr.Textbox(
346
- label="Transcript translated in English by Whisper",
347
  lines=4,
348
  elem_id="translated"
349
  )
350
  with gr.Row():
351
  clear_btn = gr.Button(value="Clear")
352
- diffuse_btn = gr.Button(value="OK, Diffuse this prompt !", elem_id="diffuse_btn")
353
 
354
  clear_btn.click(fn=lambda value: gr.update(value=""), inputs=clear_btn, outputs=translated_output)
355
 
@@ -362,8 +365,9 @@ with gr.Blocks(css=css) as demo:
362
 
363
 
364
  gr.Markdown("""
365
- ## 3. Wait for Stable Diffusion Results β˜•οΈ
366
- Inference time is about ~20-30 seconds, when it's your turn 😬
 
367
  """
368
  )
369
 
@@ -458,6 +462,8 @@ with gr.Blocks(css=css) as demo:
458
  )
459
  gr.HTML('''
460
  <div class="footer">
 
 
461
  <p>Whisper by <a href="https://github.com/openai/whisper" target="_blank">OpenAI</a> - Stable Diffusion by <a href="https://huggingface.co/CompVis" target="_blank">CompVis</a> and <a href="https://huggingface.co/stabilityai" target="_blank">Stability AI</a>
462
  </p>
463
  </div>
 
12
  stable_diffusion = gr.Blocks.load(name="spaces/stabilityai/stable-diffusion")
13
  ### β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
14
 
15
+ title="Draw Me an Insect 🐞 /Dessine-moi un insecte 🐞"
16
 
17
  ### β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
18
 
 
274
  with gr.Column():
275
  gr.HTML('''
276
  <h1>
277
+ Draw Me an Insect 🐞
278
+ Dessine-moi un insecte 🐞
279
  </h1>
280
  <p style='text-align: center;'>
281
+ Tell the AI the story of your first insect encounter and it will generate an image to illustrate it!
282
+ Raconte à l'IA l'histoire de ta première rencontre avec les insectes et ça va génerer une image pour l'illustrer!
283
  </p>
284
 
285
  <p style='text-align: center;'>
286
+ This demo uses [Whisper](https://huggingface.co/openai/whisper-small) to transcribe your story and [Stable Diffusion v 1.4](https://huggingface.co/CompVis/stable-diffusion-v1-4) to illustrate it.
287
+ Cette dΓ©monstration utilise [Whisper](https://huggingface.co/openai/whisper-small) pour transcrire ton histoire et [Stable Diffusion v 1.4](https://huggingface.co/CompVis/stable-diffusion-v1-4) pour l'illustrer.
288
  </p>
289
 
290
  ''')
 
294
  gr.Markdown(
295
  """
296
 
297
+ ## 1. Record audio or Upload an audio file/ Enregistrer de l'audio ou tΓ©lΓ©verser un fichier audio :
298
+
299
  """
300
  )
301
 
302
+ with gr.Tab(label="Record/Enregistrer", elem_id="record_tab"):
303
  with gr.Column():
304
  record_input = gr.Audio(
305
  source="microphone",
 
308
  elem_id="record_btn"
309
  )
310
  with gr.Row():
311
+ audio_r_translate = gr.Button("Check the transcription/VΓ©rifier la transcription πŸ‘", elem_id="check_btn_1")
312
+ audio_r_direct_sd = gr.Button("Generate the image right now! / GΓ©nerer l'image directement! πŸ–ŒοΈ", elem_id="magic_btn_1")
313
 
314
+ with gr.Tab(label="Upload audio/TΓ©lΓ©verser audio", elem_id="upload_tab"):
315
  with gr.Column():
316
  upload_input = gr.Audio(
317
  source="upload",
 
320
  elem_id="upload_area"
321
  )
322
  with gr.Row():
323
+ audio_u_translate = gr.Button("Check the transcription/VΓ©rifier la transcription πŸ‘", elem_id="check_btn_2")
324
+ audio_u_direct_sd = gr.Button("Generate the image right now! / GΓ©nerer l'image directement! πŸ–ŒοΈ", elem_id="magic_btn_2")
325
 
326
+ with gr.Accordion(label="Image generation Settings/Configuration de gΓ©nΓ©ration d'image", elem_id="sd_settings", visible=False):
327
  with gr.Row():
328
  guidance_scale = gr.Slider(2, 15, value = 7, label = 'Guidance Scale')
329
  nb_iterations = gr.Slider(10, 50, value = 25, step = 1, label = 'Steps')
 
331
 
332
  gr.Markdown(
333
  """
334
+ ## 2. Check the text output, correct it if necessary/VΓ©rifier la transcription, corriger si nΓ©cessaire:
335
  """
336
  )
337
 
338
  with gr.Row():
339
 
340
  transcripted_output = gr.Textbox(
341
+ label="Transcription",
342
  lines=3,
343
  elem_id="transcripted"
344
  )
 
346
 
347
  with gr.Column():
348
  translated_output = gr.Textbox(
349
+ label="Transcription in English/ Transcription traduite en anglais",
350
  lines=4,
351
  elem_id="translated"
352
  )
353
  with gr.Row():
354
  clear_btn = gr.Button(value="Clear")
355
+ diffuse_btn = gr.Button(value="Generate image! GΓ©nΓ©rer l'image!", elem_id="diffuse_btn")
356
 
357
  clear_btn.click(fn=lambda value: gr.update(value=""), inputs=clear_btn, outputs=translated_output)
358
 
 
365
 
366
 
367
  gr.Markdown("""
368
+ ## 3. Wait for your image/Attendre ton image β˜•οΈ
369
+ This can take ~20-30 seconds/ Ceci peut prendre jusqu'Γ  20-30 secondes.
370
+
371
  """
372
  )
373
 
 
462
  )
463
  gr.HTML('''
464
  <div class="footer">
465
+ <p> This Space is based on the <a href="https://huggingface.co/spaces/fffiloni/whisper-to-stable-diffusion" target="_blank">Whisper to Stable Diffusion Space</a> created by a href="https://twitter.com/fffiloni" target="_blank">Sylvain Filoni</a>.
466
+ </p>
467
  <p>Whisper by <a href="https://github.com/openai/whisper" target="_blank">OpenAI</a> - Stable Diffusion by <a href="https://huggingface.co/CompVis" target="_blank">CompVis</a> and <a href="https://huggingface.co/stabilityai" target="_blank">Stability AI</a>
468
  </p>
469
  </div>