sharmavaruncs commited on
Commit
a71ad3a
·
1 Parent(s): a11efd4

setting unsafe true^Cor spinner

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -289,10 +289,8 @@ def load_model():
289
  # Load the model
290
  multiModel = MultimodalModel(bert_model_name, num_labels)
291
 
292
- # Load the model weights directly from Hugging Face Spaces
293
  multiModel.load_state_dict(torch.hub.load_state_dict_from_url(model_weights_path, map_location=device), strict=False)
294
-
295
- # multiModel.load_state_dict(torch.load(file_path + "/MultiModal_model_state_dict.pth",map_location=device),strict=False)
296
  tokenizer = AutoTokenizer.from_pretrained("netgvarun2005/MultiModalBertHubertTokenizer")
297
 
298
  # GenAI
@@ -421,7 +419,7 @@ def process_file(ser_model,tokenizer,gpt_model,gpt_tokenizer):
421
 
422
  try:
423
  audio_array, sr = librosa.load(preprocessWavFile(temp_filename), sr=None)
424
- with st.spinner(st.markdown("<p style='font-size: 16px; font-weight: bold;'>Generating transcriptions in the side pane! Please wait...</p>", unsafe_allow_html=False)):
425
  transcription = speechtoText(temp_filename)
426
  emo = predict(audio_array,ser_model,2,tokenizer,transcription)
427
  # Display the transcription in a textbox
@@ -436,7 +434,7 @@ def process_file(ser_model,tokenizer,gpt_model,gpt_tokenizer):
436
  # Store the value of emo in the session state
437
  st.session_state.emo = emo
438
  if st.button(button_label):
439
- with st.spinner(st.markdown("<p style='font-size: 16px; font-weight: bold;'>Generating tips (it may take upto 3-4 mins depending upon network speed). Please wait...</p>", unsafe_allow_html=False)):
440
  # Retrieve prompt from the emotion
441
  emo = st.session_state.emo
442
  # Call the function for GENAI
 
289
  # Load the model
290
  multiModel = MultimodalModel(bert_model_name, num_labels)
291
 
292
+ # Load the model weights and tokenizer directly from Hugging Face Spaces
293
  multiModel.load_state_dict(torch.hub.load_state_dict_from_url(model_weights_path, map_location=device), strict=False)
 
 
294
  tokenizer = AutoTokenizer.from_pretrained("netgvarun2005/MultiModalBertHubertTokenizer")
295
 
296
  # GenAI
 
419
 
420
  try:
421
  audio_array, sr = librosa.load(preprocessWavFile(temp_filename), sr=None)
422
+ with st.spinner(st.markdown("<p style='font-size: 16px; font-weight: bold;'>Generating transcriptions in the side pane! Please wait...</p>", unsafe_allow_html=True)):
423
  transcription = speechtoText(temp_filename)
424
  emo = predict(audio_array,ser_model,2,tokenizer,transcription)
425
  # Display the transcription in a textbox
 
434
  # Store the value of emo in the session state
435
  st.session_state.emo = emo
436
  if st.button(button_label):
437
+ with st.spinner(st.markdown("<p style='font-size: 16px; font-weight: bold;'>Generating tips (it may take upto 3-4 mins depending upon network speed). Please wait...</p>", unsafe_allow_html=True)):
438
  # Retrieve prompt from the emotion
439
  emo = st.session_state.emo
440
  # Call the function for GENAI