fffiloni commited on
Commit
91ec96f
·
verified ·
1 Parent(s): b641e52

add examples + credits

Browse files
Files changed (1) hide show
  1. app.py +35 -3
app.py CHANGED
@@ -5,7 +5,7 @@ from auffusion_pipeline import AuffusionPipeline
5
 
6
  pipeline = AuffusionPipeline.from_pretrained("auffusion/auffusion")
7
 
8
- def infer(prompt):
9
 
10
  prompt = prompt
11
  output = pipeline(prompt=prompt)
@@ -14,13 +14,45 @@ def infer(prompt):
14
 
15
  return f"{prompt}.wav"
16
 
17
- with gr.Blocks() as demo:
18
- with gr.Column():
 
 
 
 
 
 
19
  gr.Markdown("# Auffusion")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  prompt = gr.Textbox(label="Prompt")
21
  submit_btn = gr.Button("Submit")
22
  audio_out = gr.Audio(label="Audio Ressult")
23
 
 
 
 
 
 
 
 
 
24
  submit_btn.click(
25
  fn = infer,
26
  inputs = [prompt],
 
5
 
6
  pipeline = AuffusionPipeline.from_pretrained("auffusion/auffusion")
7
 
8
+ def infer(prompt, progress=gr.Progress(track_tqdm=True)):
9
 
10
  prompt = prompt
11
  output = pipeline(prompt=prompt)
 
14
 
15
  return f"{prompt}.wav"
16
 
17
+ css="""
18
+ div#col-container{
19
+ margin: 0 auto;
20
+ max-width: 640px;
21
+ }
22
+ """
23
+ with gr.Blocks(css=css) as demo:
24
+ with gr.Column(elem_id="col-container"):
25
  gr.Markdown("# Auffusion")
26
+ gr.Markdown("Auffusion can generate realistic audios including human sounds, animal sounds, natural and artificial sounds and sound effects from textual prompts. ")
27
+ gr.HTML("""
28
+ <div style="display:flex;column-gap:4px;">
29
+ <a href="https://auffusion.github.io/">
30
+ <img src='https://img.shields.io/badge/Project-Page-green'>
31
+ </a>
32
+ <a href="https://github.com/happylittlecat2333/Auffusion">
33
+ <img src='https://img.shields.io/badge/GitHub-Repo-blue'>
34
+ </a>
35
+ <a href="https://arxiv.org/pdf/2401.01044">
36
+ <img src='https://img.shields.io/badge/ArXiv-Paper-red'>
37
+ </a>
38
+ <a href="https://huggingface.co/spaces/fffiloni/auffusion?duplicate=true">
39
+ <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-sm.svg" alt="Duplicate this Space">
40
+ </a>
41
+ </div>
42
+ """)
43
+
44
  prompt = gr.Textbox(label="Prompt")
45
  submit_btn = gr.Button("Submit")
46
  audio_out = gr.Audio(label="Audio Ressult")
47
 
48
+ gr.Examples(
49
+ examples = [
50
+ "Rolling thunder with lightning strikes",
51
+ "Two gunshots followed by birds chirping",
52
+ "A train whistle blowing in the distance"
53
+ ]
54
+ )
55
+
56
  submit_btn.click(
57
  fn = infer,
58
  inputs = [prompt],