Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	Update apis/chat_api.py
Browse files- apis/chat_api.py +5 -4
 
    	
        apis/chat_api.py
    CHANGED
    
    | 
         @@ -109,11 +109,12 @@ class ChatAPIApp: 
     | 
|
| 109 | 
         
             
                        mp3_fp = BytesIO()
         
     | 
| 110 | 
         
             
                        #audioobj.save(fileName)
         
     | 
| 111 | 
         
             
                        audioobj.write_to_fp(mp3_fp)
         
     | 
| 112 | 
         
            -
                         
     | 
| 113 | 
         
             
                        #base64EncodedStr = base64.encodebytes(buffer)
         
     | 
| 114 | 
         
            -
                        mp3_fp.read()
         
     | 
| 115 | 
         
            -
                        return Response(content=mp3_fp.tell(), media_type="audio/mpeg")
         
     | 
| 116 | 
         
            -
             
     | 
| 
         | 
|
| 117 | 
         
             
                           item_response = {
         
     | 
| 118 | 
         
             
                             "status": 400
         
     | 
| 119 | 
         
             
                           }
         
     | 
| 
         | 
|
| 109 | 
         
             
                        mp3_fp = BytesIO()
         
     | 
| 110 | 
         
             
                        #audioobj.save(fileName)
         
     | 
| 111 | 
         
             
                        audioobj.write_to_fp(mp3_fp)
         
     | 
| 112 | 
         
            +
                        buffer = bytearray(mp3_fp.read())
         
     | 
| 113 | 
         
             
                        #base64EncodedStr = base64.encodebytes(buffer)
         
     | 
| 114 | 
         
            +
                        #mp3_fp.read()
         
     | 
| 115 | 
         
            +
                        #return Response(content=mp3_fp.tell(), media_type="audio/mpeg")
         
     | 
| 116 | 
         
            +
                        return buffer
         
     | 
| 117 | 
         
            +
                    except:
         
     | 
| 118 | 
         
             
                           item_response = {
         
     | 
| 119 | 
         
             
                             "status": 400
         
     | 
| 120 | 
         
             
                           }
         
     |