aliabd HF Staff commited on
Commit
bf9dc0c
·
1 Parent(s): 786f283

Upload with huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +6 -7
  2. beep.mp3 +0 -0
  3. requirements.txt +1 -0
  4. run.py +17 -0
README.md CHANGED
@@ -1,12 +1,11 @@
 
1
  ---
2
- title: Sound Alert Main
3
- emoji: 📉
4
- colorFrom: purple
5
- colorTo: gray
6
  sdk: gradio
7
  sdk_version: 3.6
8
- app_file: app.py
9
  pinned: false
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
+
2
  ---
3
+ title: sound_alert_main
4
+ emoji: 🔥
5
+ colorFrom: indigo
6
+ colorTo: indigo
7
  sdk: gradio
8
  sdk_version: 3.6
9
+ app_file: run.py
10
  pinned: false
11
  ---
 
 
beep.mp3 ADDED
Binary file (6.32 kB). View file
 
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ https://gradio-main-build.s3.amazonaws.com/c3bec6153737855510542e8154391f328ac72606/gradio-3.6-py3-none-any.whl
run.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import time
2
+ import gradio as gr
3
+
4
+
5
+ js_function = "() => {new Audio('file=beep.mp3').play();}"
6
+
7
+ def task(x):
8
+ time.sleep(2)
9
+ return "Hello, " + x
10
+
11
+ with gr.Blocks() as demo:
12
+ name = gr.Textbox(label="name")
13
+ greeting = gr.Textbox(label="greeting")
14
+ name.blur(task, name, greeting)
15
+ greeting.change(None, [], [], _js=js_function) # Note that _js is a special arugment whose usage may change in the future
16
+
17
+ demo.launch()