Updated app.py for latest Gradio version 4.0

#2
Files changed (1) hide show
  1. app.py +3 -10
app.py CHANGED
@@ -84,18 +84,13 @@ description = """
84
  <br>
85
  🎯 The sentiment analysis results are provided as a dictionary with different emotions and their corresponding scores.<br>
86
  <br>
87
-
88
  😃 The sentiment analysis results are displayed with emojis representing the corresponding sentiment.<br>
89
  <br>
90
-
91
  ✅ The higher the score for a specific emotion, the stronger the presence of that emotion in the transcribed text.<br>
92
  <br>
93
-
94
  ❓ Use the microphone for real-time speech recognition.<br>
95
  <br>
96
-
97
  ⚡️ The model will transcribe the audio and perform sentiment analysis on the transcribed text.<br>
98
-
99
  """
100
 
101
  custom_css = """
@@ -122,18 +117,16 @@ with block:
122
  gr.HTML(description)
123
 
124
  with gr.Group():
125
- with gr.Box():
126
  audio = gr.Audio(
127
  label="Input Audio",
128
  show_label=False,
129
- source="microphone",
130
  type="filepath"
131
  )
132
 
133
  sentiment_option = gr.Radio(
134
  choices=["Sentiment Only", "Sentiment + Score"],
135
  label="Select an option",
136
- default="Sentiment Only"
137
  )
138
 
139
  btn = gr.Button("Transcribe")
@@ -142,7 +135,7 @@ with block:
142
 
143
  text = gr.Textbox(label="Transcription")
144
 
145
- sentiment_output = gr.Textbox(label="Sentiment Analysis Results", output=True)
146
 
147
  btn.click(inference, inputs=[audio, sentiment_option], outputs=[lang_str, text, sentiment_output])
148
 
@@ -153,4 +146,4 @@ with block:
153
  </div>
154
  ''')
155
 
156
- block.launch()
 
84
  <br>
85
  🎯 The sentiment analysis results are provided as a dictionary with different emotions and their corresponding scores.<br>
86
  <br>
 
87
  😃 The sentiment analysis results are displayed with emojis representing the corresponding sentiment.<br>
88
  <br>
 
89
  ✅ The higher the score for a specific emotion, the stronger the presence of that emotion in the transcribed text.<br>
90
  <br>
 
91
  ❓ Use the microphone for real-time speech recognition.<br>
92
  <br>
 
93
  ⚡️ The model will transcribe the audio and perform sentiment analysis on the transcribed text.<br>
 
94
  """
95
 
96
  custom_css = """
 
117
  gr.HTML(description)
118
 
119
  with gr.Group():
120
+ with gr.Column():
121
  audio = gr.Audio(
122
  label="Input Audio",
123
  show_label=False,
 
124
  type="filepath"
125
  )
126
 
127
  sentiment_option = gr.Radio(
128
  choices=["Sentiment Only", "Sentiment + Score"],
129
  label="Select an option",
 
130
  )
131
 
132
  btn = gr.Button("Transcribe")
 
135
 
136
  text = gr.Textbox(label="Transcription")
137
 
138
+ sentiment_output = gr.Textbox(label="Sentiment Analysis Results")
139
 
140
  btn.click(inference, inputs=[audio, sentiment_option], outputs=[lang_str, text, sentiment_output])
141
 
 
146
  </div>
147
  ''')
148
 
149
+ block.launch()