doevent commited on
Commit
e65415c
·
1 Parent(s): 36ee14d

Update gradio

Browse files
Files changed (1) hide show
  1. app.py +15 -17
app.py CHANGED
@@ -24,7 +24,7 @@ def inference(audio):
24
  result = start(to_list_files=[audio])
25
  return result[0]
26
  except Exception as e:
27
- return "error.wav"
28
 
29
 
30
  title = """<h1 id="title">DeNoise Speech Enhancement</h1>"""
@@ -40,28 +40,26 @@ h1#title {
40
  }
41
  '''
42
 
43
- demo = gr.Blocks(css=css)
44
- with demo:
45
  gr.Markdown(title)
46
  gr.Markdown(description)
47
  gr.Markdown(twitter_link)
48
 
49
 
50
- with gr.Tabs():
51
- with gr.TabItem("Upload audio"):
52
- iface = gr.Interface(
53
- inference,
54
- inputs = gr.Audio(source="upload", type="filepath"),
55
- outputs = gr.Audio(type="file"),
56
- examples=[["man.wav"], ["woman.wav"]])
57
- with gr.TabItem("Record your voice"):
58
- iface = gr.Interface(
59
- inference,
60
- inputs = gr.Audio(source="microphone", label="Record yourself reading something out loud", type="filepath"),
61
- outputs = gr.Audio(type="file"),
62
- )
63
 
 
 
 
 
 
 
 
 
64
  gr.Markdown("<div><center><img src='https://visitor-badge.glitch.me/badge?page_id=max_skobeev_fullsubnet_plus_public' alt='visitor badge'></center></div>")
65
 
66
 
67
- demo.launch(enable_queue=True, debug=True, show_error=True)
 
24
  result = start(to_list_files=[audio])
25
  return result[0]
26
  except Exception as e:
27
+ gr.Error(f"Maximum duration 150 sec\n{str(e)}")
28
 
29
 
30
  title = """<h1 id="title">DeNoise Speech Enhancement</h1>"""
 
40
  }
41
  '''
42
 
43
+ with gr.Blocks(css=css) as demo:
 
44
  gr.Markdown(title)
45
  gr.Markdown(description)
46
  gr.Markdown(twitter_link)
47
 
48
 
49
+ with gr.Tab("Upload audio"):
50
+ u_audio = gr.Audio(type="filepath", source="upload", label="Input audio")
51
+ u_output = gr.Audio(type="filepath", label="Output audio")
52
+ u_button = gr.Button("Submit")
 
 
 
 
 
 
 
 
 
53
 
54
+ with gr.Tab("Record your voice"):
55
+ m_audio = gr.Audio(ype="filepath", source="microphone", label="Record yourself reading something out loud")
56
+ m_output = gr.Audio(type="filepath", label="Output audio")
57
+ m_button = gr.Button("Submit")
58
+
59
+ gr.Examples(examples=["man.wav", "woman.wav"], inputs=u_audio, outputs=u_output, fn=inference, cache_examples=True)
60
+ u_button.click(inference, inputs=u_audio, outputs=u_output)
61
+ m_button.click(inference, inputs=m_audio, outputs=m_output)
62
  gr.Markdown("<div><center><img src='https://visitor-badge.glitch.me/badge?page_id=max_skobeev_fullsubnet_plus_public' alt='visitor badge'></center></div>")
63
 
64
 
65
+ demo.queue().launch(show_error=True)