Omarrran commited on
Commit
d7e5954
·
verified ·
1 Parent(s): 4ffe582

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -21
app.py CHANGED
@@ -351,28 +351,29 @@ Font_Style: {metadata['font_style']}
351
  self.log_operation(error_msg, "error")
352
  logger.error(traceback.format_exc())
353
 
354
- def get_navigation_info(self) -> Dict[str, Optional[str]]:
355
- """Get current and next sentence information"""
356
- if not self.sentences:
357
- return {
358
- 'current': None,
359
- 'next': None,
360
- 'progress': "No text loaded"
361
- }
362
-
363
- current = self.get_styled_text(self.sentences[self.current_index])
364
- next_text = None
365
-
366
- if self.current_index < len(self.sentences) - 1:
367
- next_text = self.get_styled_text(self.sentences[self.current_index + 1])
368
-
369
- progress = f"Sentence {self.current_index + 1} of {len(self.sentences)}"
370
-
371
  return {
372
- 'current': current,
373
- 'next': next_text,
374
- 'progress': progress
375
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376
 
377
  def navigate(self, direction: str) -> Dict[str, Optional[str]]:
378
  """Navigate through sentences"""
@@ -407,6 +408,8 @@ Font_Style: {metadata['font_style']}
407
  logger.error(f"Error reading dataset statistics: {str(e)}")
408
  return {}
409
 
 
 
410
  def create_interface():
411
  """Create Gradio interface with enhanced features"""
412
 
@@ -441,7 +444,6 @@ def create_interface():
441
 
442
  collector = TTSDatasetCollector()
443
 
444
-
445
  with gr.Blocks(title="TTS Dataset Collection Tool", css=custom_css) as interface:
446
  gr.Markdown("# TTS Dataset Collection Tool")
447
 
 
351
  self.log_operation(error_msg, "error")
352
  logger.error(traceback.format_exc())
353
 
354
+ # Add these methods to the TTSDatasetCollector class
355
+ def get_navigation_info(self) -> Dict[str, Optional[str]]:
356
+ """Get current and next sentence information"""
357
+ if not self.sentences:
 
 
 
 
 
 
 
 
 
 
 
 
 
358
  return {
359
+ 'current': None,
360
+ 'next': None,
361
+ 'progress': "No text loaded"
362
  }
363
+
364
+ current = self.get_styled_text(self.sentences[self.current_index])
365
+ next_text = None
366
+
367
+ if self.current_index < len(self.sentences) - 1:
368
+ next_text = self.get_styled_text(self.sentences[self.current_index + 1])
369
+
370
+ progress = f"Sentence {self.current_index + 1} of {len(self.sentences)}"
371
+
372
+ return {
373
+ 'current': current,
374
+ 'next': next_text,
375
+ 'progress': progress
376
+ }
377
 
378
  def navigate(self, direction: str) -> Dict[str, Optional[str]]:
379
  """Navigate through sentences"""
 
408
  logger.error(f"Error reading dataset statistics: {str(e)}")
409
  return {}
410
 
411
+
412
+ # Then create the interface function outside the class
413
  def create_interface():
414
  """Create Gradio interface with enhanced features"""
415
 
 
444
 
445
  collector = TTSDatasetCollector()
446
 
 
447
  with gr.Blocks(title="TTS Dataset Collection Tool", css=custom_css) as interface:
448
  gr.Markdown("# TTS Dataset Collection Tool")
449