sharmavaruncs commited on
Commit
3ba6977
·
1 Parent(s): 75df515

replaced recording with uploading

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -289,11 +289,11 @@ def process_file(ser_model,tokenizer,gpt_model,gpt_tokenizer):
289
  button_label = "Show Helpful Tips"
290
  # recorded = False # Initialize the recording state as False
291
 
292
- if 'stage' not in st.session_state:
293
- st.session_state.stage = 0
294
 
295
- def set_stage(stage):
296
- st.session_state.stage = stage
297
 
298
  # # Add custom CSS styles
299
  # st.markdown("""
@@ -320,6 +320,9 @@ def process_file(ser_model,tokenizer,gpt_model,gpt_tokenizer):
320
  # }
321
  # </style>
322
  # """, unsafe_allow_html=True)
 
 
 
323
 
324
  # if st.sidebar.button("Record a 4 sec audio!", key="record_button", help="Click to start recording", on_click=set_stage, args=(1,)):
325
  # # Your button click action here
@@ -380,11 +383,11 @@ def process_file(ser_model,tokenizer,gpt_model,gpt_tokenizer):
380
  # else:
381
  # st.error(f"An error occurred while recording: {str(e)}")
382
 
383
- if st.session_state.stage > 0:
384
- if st.button(button_label,on_click=set_stage, args=(2,)):
385
- # Retrieve prompt from the emotion
386
- emo = st.session_state.emo
387
- GenerateText(emo,gpt_tokenizer,gpt_model)
388
 
389
  if __name__ == '__main__':
390
  config()
 
289
  button_label = "Show Helpful Tips"
290
  # recorded = False # Initialize the recording state as False
291
 
292
+ # if 'stage' not in st.session_state:
293
+ # st.session_state.stage = 0
294
 
295
+ # def set_stage(stage):
296
+ # st.session_state.stage = stage
297
 
298
  # # Add custom CSS styles
299
  # st.markdown("""
 
320
  # }
321
  # </style>
322
  # """, unsafe_allow_html=True)
323
+ if st.sidebar.button("Open External Audio Recorder"):
324
+ # Redirect the user to the external website
325
+ st.markdown("Redirecting to the [external audio recorder](https://voice-recorder-online.com/).")
326
 
327
  # if st.sidebar.button("Record a 4 sec audio!", key="record_button", help="Click to start recording", on_click=set_stage, args=(1,)):
328
  # # Your button click action here
 
383
  # else:
384
  # st.error(f"An error occurred while recording: {str(e)}")
385
 
386
+ # if st.session_state.stage > 0:
387
+ if st.button(button_label):
388
+ # Retrieve prompt from the emotion
389
+ emo = st.session_state.emo
390
+ GenerateText(emo,gpt_tokenizer,gpt_model)
391
 
392
  if __name__ == '__main__':
393
  config()