Spaces:
				
			
			
	
			
			
		Build error
		
	
	
	
			
			
	
	
	
	
		
		
		Build error
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -21,7 +21,7 @@ torch_dtype = torch.float32 
     | 
|
| 21 | 
         
             
            model.to(device)
         
     | 
| 22 | 
         | 
| 23 | 
         | 
| 24 | 
         
            -
            def transcribe_audio(audio_file):
         
     | 
| 25 | 
         
             
                audio_input, sample_rate = sf.read(audio_file)
         
     | 
| 26 | 
         
             
                chunk_size = 16000 * 28  # 28 seconds chunks, seems to work best
         
     | 
| 27 | 
         
             
                chunks = [audio_input[i:i + chunk_size] for i in range(0, len(audio_input), chunk_size)]
         
     | 
| 
         @@ -44,10 +44,15 @@ def transcribe_audio(audio_file): 
     | 
|
| 44 | 
         
             
                        )
         
     | 
| 45 | 
         
             
                    transcription += " ".join(processor.batch_decode(output, skip_special_tokens=True)) + " "
         
     | 
| 46 | 
         | 
| 
         | 
|
| 
         | 
|
| 47 | 
         
             
            # HTML |banner image
         
     | 
| 48 | 
         
             
            banner_html = """
         
     | 
| 49 | 
         
             
            <div style="text-align: center;">
         
     | 
| 50 | 
         
            -
                <img src="https://huggingface.co/spaces/camparchimedes/ola_s-audioshop/raw/main/Olas%20AudioSwitch%20Shop.png" alt="Banner" width="87 
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 51 | 
         
             
            </div>
         
     | 
| 52 | 
         
             
            """
         
     | 
| 53 | 
         | 
| 
         | 
|
| 21 | 
         
             
            model.to(device)
         
     | 
| 22 | 
         | 
| 23 | 
         | 
| 24 | 
         
            +
            def transcribe_audio(audio_file, batch_size=4):
         
     | 
| 25 | 
         
             
                audio_input, sample_rate = sf.read(audio_file)
         
     | 
| 26 | 
         
             
                chunk_size = 16000 * 28  # 28 seconds chunks, seems to work best
         
     | 
| 27 | 
         
             
                chunks = [audio_input[i:i + chunk_size] for i in range(0, len(audio_input), chunk_size)]
         
     | 
| 
         | 
|
| 44 | 
         
             
                        )
         
     | 
| 45 | 
         
             
                    transcription += " ".join(processor.batch_decode(output, skip_special_tokens=True)) + " "
         
     | 
| 46 | 
         | 
| 47 | 
         
            +
                return transcription.strip()
         
     | 
| 48 | 
         
            +
             
     | 
| 49 | 
         
             
            # HTML |banner image
         
     | 
| 50 | 
         
             
            banner_html = """
         
     | 
| 51 | 
         
             
            <div style="text-align: center;">
         
     | 
| 52 | 
         
            +
                <img src="https://huggingface.co/spaces/camparchimedes/ola_s-audioshop/raw/main/Olas%20AudioSwitch%20Shop.png" alt="Banner" width="87%" height="auto">
         
     | 
| 53 | 
         
            +
            </div>
         
     | 
| 54 | 
         
            +
            <div style="text-align: center; margin-top: 20px;">
         
     | 
| 55 | 
         
            +
                <img src="https://huggingface.co/spaces/camparchimedes/ola_s-audioshop/raw/main/picture.jpg" alt="Additional Image" width="50%" height="auto">
         
     | 
| 56 | 
         
             
            </div>
         
     | 
| 57 | 
         
             
            """
         
     | 
| 58 | 
         |