Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	Fix preprocessor when words are disabled
Browse files- src/utils.py +9 -8
    	
        src/utils.py
    CHANGED
    
    | @@ -105,16 +105,17 @@ def __subtitle_preprocessor_iterator(transcript: Iterator[dict], maxLineWidth: i | |
| 105 | 
             
                    words = segment.get('words', [])
         | 
| 106 |  | 
| 107 | 
             
                    if len(words) == 0:
         | 
| 108 | 
            -
                        # Yield the segment as-is
         | 
| 109 | 
             
                        if maxLineWidth is None or maxLineWidth < 0:
         | 
| 110 | 
             
                            yield segment
         | 
| 111 | 
            -
             | 
| 112 | 
            -
             | 
| 113 | 
            -
             | 
| 114 | 
            -
             | 
| 115 | 
            -
             | 
| 116 | 
            -
                             | 
| 117 | 
            -
                         | 
|  | |
| 118 |  | 
| 119 | 
             
                    subtitle_start = segment['start']
         | 
| 120 | 
             
                    subtitle_end = segment['end']
         | 
|  | |
| 105 | 
             
                    words = segment.get('words', [])
         | 
| 106 |  | 
| 107 | 
             
                    if len(words) == 0:
         | 
| 108 | 
            +
                        # Yield the segment as-is or processed
         | 
| 109 | 
             
                        if maxLineWidth is None or maxLineWidth < 0:
         | 
| 110 | 
             
                            yield segment
         | 
| 111 | 
            +
                        else:
         | 
| 112 | 
            +
                            yield {
         | 
| 113 | 
            +
                                'start': segment['start'],
         | 
| 114 | 
            +
                                'end': segment['end'],
         | 
| 115 | 
            +
                                'text': process_text(segment['text'].strip(), maxLineWidth)
         | 
| 116 | 
            +
                            }
         | 
| 117 | 
            +
                        # We are done
         | 
| 118 | 
            +
                        continue
         | 
| 119 |  | 
| 120 | 
             
                    subtitle_start = segment['start']
         | 
| 121 | 
             
                    subtitle_end = segment['end']
         |