sharmavaruncs commited on
Commit
f3d0762
·
1 Parent(s): f1acde1

Hypter link button added

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -29,6 +29,7 @@ from transformers import (
29
  )
30
  from transformers import AutoTokenizer, AutoModelForCausalLM
31
  import webbrowser
 
32
 
33
  emo2promptMapping = {
34
  'Angry':'ANGRY',
@@ -60,6 +61,15 @@ model_weights_path = "https://huggingface.co/netgvarun2005/MultiModalBertHubert/
60
  model_id = "facebook/hubert-base-ls960"
61
  bert_model_name = "bert-base-uncased"
62
 
 
 
 
 
 
 
 
 
 
63
  def config():
64
  # Loading Image using PIL
65
  im = Image.open('./icon.png')
@@ -75,7 +85,9 @@ def config():
75
  # # ''', unsafe_allow_html=True)
76
  # st.markdown("<a href='https://voice-recorder-online.com/' target='_blank'>Redirecting to the external audio recorder</a>.", unsafe_allow_html=True)
77
 
78
- st.sidebar.button('[**Open External Audio Recorder**](https://voice-recorder-online.com/)')
 
 
79
 
80
  # Add custom CSS styles
81
  st.markdown("""
@@ -138,7 +150,6 @@ class MultimodalModel(nn.Module):
138
  logits = self.classifier(concat_output)
139
  return logits
140
 
141
-
142
  def speechtoText(wavfile):
143
  return speech_model.transcribe(wavfile)['text']
144
 
 
29
  )
30
  from transformers import AutoTokenizer, AutoModelForCausalLM
31
  import webbrowser
32
+ from streamlit.components.v1 import html
33
 
34
  emo2promptMapping = {
35
  'Angry':'ANGRY',
 
61
  model_id = "facebook/hubert-base-ls960"
62
  bert_model_name = "bert-base-uncased"
63
 
64
+
65
+ def open_page(url):
66
+ open_script= """
67
+ <script type="text/javascript">
68
+ window.open('%s', '_blank').focus();
69
+ </script>
70
+ """ % (url)
71
+ html(open_script)
72
+
73
  def config():
74
  # Loading Image using PIL
75
  im = Image.open('./icon.png')
 
85
  # # ''', unsafe_allow_html=True)
86
  # st.markdown("<a href='https://voice-recorder-online.com/' target='_blank'>Redirecting to the external audio recorder</a>.", unsafe_allow_html=True)
87
 
88
+ # st.sidebar.button('[**Open External Audio Recorder**]()')
89
+ st.sidebar.button('Open link', on_click=open_page("https://voice-recorder-online.com/"))
90
+
91
 
92
  # Add custom CSS styles
93
  st.markdown("""
 
150
  logits = self.classifier(concat_output)
151
  return logits
152
 
 
153
  def speechtoText(wavfile):
154
  return speech_model.transcribe(wavfile)['text']
155