Spaces:
Runtime error
Runtime error
lhzstar
commited on
Commit
·
325f09c
1
Parent(s):
e916883
new commits
Browse files
app.py
CHANGED
@@ -35,8 +35,11 @@ def main():
|
|
35 |
st.session_state["celeb_bot"] = None
|
36 |
|
37 |
def text_submit():
|
38 |
-
st.session_state["prompt_from_text"] = st.session_state.
|
39 |
-
st.session_state.
|
|
|
|
|
|
|
40 |
|
41 |
st.session_state["celeb_name"] = st.sidebar.selectbox('Choose a celebrity', options=list(celeb_data.keys()))
|
42 |
model_id=st.sidebar.selectbox("Choose Your Flan-T5 model",options=model_list)
|
@@ -62,8 +65,17 @@ def main():
|
|
62 |
if "_last_audio_id" not in st.session_state:
|
63 |
st.session_state["_last_audio_id"] = 0
|
64 |
with st.sidebar:
|
|
|
65 |
st.session_state["prompt_from_audio"] = speech_to_text(start_prompt="Start Recording",stop_prompt="Stop Recording",language='en',use_container_width=True, just_once=True,key='STT')
|
66 |
-
st.text_input('Or write something', key='
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
if st.session_state["prompt_from_audio"] != None:
|
69 |
prompt = st.session_state["prompt_from_audio"]
|
|
|
35 |
st.session_state["celeb_bot"] = None
|
36 |
|
37 |
def text_submit():
|
38 |
+
st.session_state["prompt_from_text"] = st.session_state.text_input
|
39 |
+
st.session_state.text_input = ''
|
40 |
+
|
41 |
+
def example_submit(text):
|
42 |
+
st.session_state["prompt_from_text"] = text
|
43 |
|
44 |
st.session_state["celeb_name"] = st.sidebar.selectbox('Choose a celebrity', options=list(celeb_data.keys()))
|
45 |
model_id=st.sidebar.selectbox("Choose Your Flan-T5 model",options=model_list)
|
|
|
65 |
if "_last_audio_id" not in st.session_state:
|
66 |
st.session_state["_last_audio_id"] = 0
|
67 |
with st.sidebar:
|
68 |
+
st.write("You can record your question...")
|
69 |
st.session_state["prompt_from_audio"] = speech_to_text(start_prompt="Start Recording",stop_prompt="Stop Recording",language='en',use_container_width=True, just_once=True,key='STT')
|
70 |
+
st.text_input('Or write something...', key='text_input', on_change=text_submit)
|
71 |
+
st.write("Example questions:")
|
72 |
+
|
73 |
+
example1 = "Hello! Did you win an Oscar?"
|
74 |
+
st.button(example1, on_click=example_submit, args=[example1])
|
75 |
+
example2 = "Hi! What is your profession?"
|
76 |
+
st.button(example2, on_click=example_submit, args=[example2])
|
77 |
+
example3 = "Can you tell me about your family background?"
|
78 |
+
st.button(example3, on_click=example_submit, args=[example3])
|
79 |
|
80 |
if st.session_state["prompt_from_audio"] != None:
|
81 |
prompt = st.session_state["prompt_from_audio"]
|