Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -100,15 +100,12 @@ class DataEditor:
|
|
100 |
self.current_selected = (self.current_page * 10) + index_now
|
101 |
row = self.data.iloc[self.current_selected]
|
102 |
txt_audio = row['text']
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
return txt_audio,None
|
110 |
-
# else:
|
111 |
-
return ""
|
112 |
|
113 |
else:
|
114 |
return None," "
|
@@ -116,19 +113,15 @@ class DataEditor:
|
|
116 |
return self.get_page_data(self.current_page),None,""
|
117 |
|
118 |
def on_row_save(self, text,data_oudio):
|
119 |
-
|
120 |
|
121 |
row = self.data.iloc[self.current_selected]
|
122 |
#row['text'] = text
|
123 |
row['flag']=1
|
124 |
self.data.iloc[self.current_selected] = row
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
return "",data_oudio
|
130 |
-
else:
|
131 |
-
return "",None
|
132 |
def on_row_delete(self):
|
133 |
if self.current_selected>=0:
|
134 |
row = self.data.iloc[self.current_selected]
|
|
|
100 |
self.current_selected = (self.current_page * 10) + index_now
|
101 |
row = self.data.iloc[self.current_selected]
|
102 |
txt_audio = row['text']
|
103 |
+
row_audio = self.sdata[self.current_selected]
|
104 |
+
if row['flag'] !=0:
|
105 |
+
return txt_audio,(44100,row_audio)
|
106 |
+
else :
|
107 |
+
return txt_audio,None
|
108 |
+
|
|
|
|
|
|
|
109 |
|
110 |
else:
|
111 |
return None," "
|
|
|
113 |
return self.get_page_data(self.current_page),None,""
|
114 |
|
115 |
def on_row_save(self, text,data_oudio):
|
116 |
+
if text!="" and data_oudio is not None:
|
117 |
|
118 |
row = self.data.iloc[self.current_selected]
|
119 |
#row['text'] = text
|
120 |
row['flag']=1
|
121 |
self.data.iloc[self.current_selected] = row
|
122 |
+
sr,audio_array=data_oudio
|
123 |
+
self.sdata[self.current_selected] =audio_array
|
124 |
+
return "",None
|
|
|
|
|
|
|
|
|
125 |
def on_row_delete(self):
|
126 |
if self.current_selected>=0:
|
127 |
row = self.data.iloc[self.current_selected]
|