VanessaCrosbyFitzgerald commited on
Commit
5b5e393
·
verified ·
1 Parent(s): fc36af8

Update home.py

Browse files
Files changed (1) hide show
  1. home.py +15 -45
home.py CHANGED
@@ -1,49 +1,19 @@
1
- # ...
2
- import streamlit as st
3
- from st_pages import Page, show_pages, add_page_title
4
 
5
- st.set_page_config(
6
- layout = "wide",
7
- page_title = "V's Gradio Sandbox",
8
- page_icon = "",
9
- )
10
-
11
- st.header("V's Gradio Sandbox")
12
- st.subheader("test...test...test")
13
-
14
- # display the menu
15
- show_pages(
16
- [
17
- Page("Home.py", "Home"),
18
- Page("pages/grAudioRecorder.py", "Streaming Audio Test"),
19
- Page("pages/grRealtimeTranscriber.py", "Realtime Transcriber"),
20
- ]
21
- )
22
-
23
- ##
24
- ## selected brand
25
- ##
26
- if 'selected_brand' not in st.session_state:
27
- st.session_state['selected_brand'] = "Taco Bell"
28
-
29
- selectOptions = ["Taco Bell", "KFC", "Habit Burger", "Pizza Hut"]
30
- selectedIndex = selectOptions.index(st.session_state['selected_brand'])
31
 
32
- selected_brand = st.sidebar.selectbox(
33
- label="Brand",
34
- options=selectOptions,
35
- index=selectedIndex,
36
- key="selectbox_key"
37
  )
38
- # Update the session state with the newly selected option
39
- st.session_state['selected_brand'] = selected_brand
40
 
41
- # display intro content
42
- with st.container(border=True):
43
- st.markdown(
44
- """
45
- This is a test of the Emergency broadcast system. If this were a real test then this would not be a test.
46
-
47
-
48
- """
49
- )
 
1
+ import gradio as gr
2
+ import soundfile as sf
3
+ import numpy as np
4
 
5
+ def save_audio(audio):
6
+ # audio is a tuple of (sample_rate, data)
7
+ sample_rate, data = audio
8
+ sf.write('recorded_audio.wav', data, sample_rate)
9
+ return "Audio saved successfully!"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
+ # Create the Gradio interface
12
+ iface = gr.Interface(
13
+ fn=save_audio,
14
+ inputs=gr.Audio("microphone",type="numpy"),
15
+ outputs="text"
16
  )
 
 
17
 
18
+ if __name__ == "__main__":
19
+ iface.launch()