andito HF staff commited on
Commit
8b97d54
β€’
1 Parent(s): 631167b

update gradio

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +16 -19
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: πŸ“š
4
  colorFrom: yellow
5
  colorTo: purple
6
  sdk: gradio
7
- sdk_version: 5.0.0b3
8
  app_file: app.py
9
  pinned: false
10
  license: apache-2.0
 
4
  colorFrom: yellow
5
  colorTo: purple
6
  sdk: gradio
7
+ sdk_version: 4.44.0
8
  app_file: app.py
9
  pinned: false
10
  license: apache-2.0
app.py CHANGED
@@ -1,23 +1,20 @@
1
  import gradio as gr
2
 
3
- t = "the big blue " * 5
4
- i = 0
 
 
 
 
 
 
 
5
 
6
- def transcribe(audio: str, state: str):
7
- global i
8
- next_chunk = t[i:i+1]
9
- i += 1
10
- state += " " + next_chunk
11
- return audio, state
12
 
13
- with gr.Blocks() as demo:
14
- gr.Markdown("# New Audio Streaming In 🎀")
15
- inp = gr.Audio(sources=["microphone"], type="filepath")
16
- out = gr.Audio(type="filepath", autoplay=True)
17
- transcription = gr.State(value="")
18
- clear = gr.Button("Clear")
19
-
20
- inp.stream(transcribe, [inp, transcription], [out, transcription], time_limit=10, stream_every=1)
21
-
22
- if __name__ == "__main__":
23
- demo.launch()
 
1
  import gradio as gr
2
 
3
+ def pass_audio(audio, test):
4
+ if test is not None:
5
+ print(len(test))
6
+ print(test[0])
7
+ print(len(test[1]))
8
+ print(test[1])
9
+ else:
10
+ print("test is None")
11
+ return audio, test
12
 
13
+ demo = gr.Interface(
14
+ pass_audio,
15
+ ["state", gr.Audio(sources=["microphone"], streaming=True)],
16
+ ["state", gr.Audio(streaming=True, autoplay=True)],
17
+ live=True,
18
+ )
19
 
20
+ demo.launch()