ASG Models commited on
Commit
3b12fe0
1 Parent(s): 6cddb08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -190,15 +190,18 @@ class DataViewerApp:
190
  self.data['text'] =self.data['text'].apply(self.remove_hamza_from_alif_and_symbols)
191
  return self.get_page_data(self.current_page)
192
  def get_text_from_audio(self,audio):
193
-
194
- sf.write("temp.wav", audio, 16000,format='WAV')
195
-
196
- client = Client("MohamedRashad/Arabic-Whisper-CodeSwitching-Edition")
197
- result = client.predict(
198
- inputs=handle_file('temp.wav'),
199
- api_name="/predict_1"
200
- )
201
- return result
 
 
 
202
  def on_column_dropdown_change_operater(self,selected_column,selected_column1):
203
  if selected_column1==">":
204
  return self.data[self.data['secs'] > selected_column ]
 
190
  self.data['text'] =self.data['text'].apply(self.remove_hamza_from_alif_and_symbols)
191
  return self.get_page_data(self.current_page)
192
  def get_text_from_audio(self,audio):
193
+ if len(audio)!=0:
194
+ sf.write("temp.wav", audio, 16000,format='WAV')
195
+
196
+ client = Client("MohamedRashad/Arabic-Whisper-CodeSwitching-Edition")
197
+ result = client.predict(
198
+ inputs=handle_file('temp.wav'),
199
+ api_name="/predict_1"
200
+ )
201
+ return result
202
+ else:
203
+ return ""
204
+
205
  def on_column_dropdown_change_operater(self,selected_column,selected_column1):
206
  if selected_column1==">":
207
  return self.data[self.data['secs'] > selected_column ]