Spaces:
				
			
			
	
			
			
		Running
		
			on 
			
			Zero
	
	
	
			
			
	
	
	
	
		
		
		Running
		
			on 
			
			Zero
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 |  | 
| 2 | 
             
            import gradio as gr
         | 
| 3 | 
             
            from whisper2 import generate
         | 
| 4 | 
            -
             | 
| 5 |  | 
| 6 | 
             
            MODEL_NAME = "/whisper-large-v3"
         | 
| 7 |  | 
| @@ -19,19 +19,31 @@ description_string = "Transcripci贸 autom脿tica de micr貌fon o de fitxers d'脿ud | |
| 19 | 
             
                          " comprovar els models de reconeixement de parla per a m贸bils. Per ara utilitza el checkpoint "\
         | 
| 20 | 
             
                          f"[{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) i la llibreria de 馃 Transformers per a la transcripci贸."
         | 
| 21 |  | 
| 22 | 
            -
            file_transcribe = gr.Interface(
         | 
| 23 | 
            -
                fn=transcribe,
         | 
| 24 | 
            -
                inputs=[
         | 
| 25 | 
            -
                    gr.Audio(sources=["upload", "microphone"], type="filepath", label="Audio")
         | 
| 26 | 
            -
                ],
         | 
| 27 | 
            -
                outputs="text",
         | 
| 28 | 
            -
                title="Transcripci贸 autom脿tica d'脿udio",
         | 
| 29 | 
            -
                description=(description_string),
         | 
| 30 | 
            -
                allow_flagging="never",
         | 
| 31 | 
            -
            )
         | 
| 32 |  | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 33 |  | 
| 34 | 
            -
            demo = gr.TabbedInterface([file_transcribe], ["Fitxer"])
         | 
| 35 |  | 
| 36 | 
             
            if __name__ == "__main__":
         | 
| 37 | 
             
                demo.launch()
         | 
|  | |
| 1 |  | 
| 2 | 
             
            import gradio as gr
         | 
| 3 | 
             
            from whisper2 import generate
         | 
| 4 | 
            +
            from AinaTheme import theme
         | 
| 5 |  | 
| 6 | 
             
            MODEL_NAME = "/whisper-large-v3"
         | 
| 7 |  | 
|  | |
| 19 | 
             
                          " comprovar els models de reconeixement de parla per a m贸bils. Per ara utilitza el checkpoint "\
         | 
| 20 | 
             
                          f"[{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) i la llibreria de 馃 Transformers per a la transcripci贸."
         | 
| 21 |  | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 22 |  | 
| 23 | 
            +
            def clear():
         | 
| 24 | 
            +
                 return (
         | 
| 25 | 
            +
                      None
         | 
| 26 | 
            +
                 )
         | 
| 27 | 
            +
             | 
| 28 | 
            +
             | 
| 29 | 
            +
            with gr.Blocks(theme=theme) as demo:
         | 
| 30 | 
            +
                gr.Markdown(description_string)
         | 
| 31 | 
            +
                with gr.Row():
         | 
| 32 | 
            +
                    with gr.Column(scale=1):
         | 
| 33 | 
            +
                        input = gr.Audio(sources=["upload", "microphone"], type="filepath", label="Audio")
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                    with gr.Column(scale=1):
         | 
| 36 | 
            +
                        temperatures = gr.CheckboxGroup(choices=[0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0], value=[0.0, 0.2, 0.4], label="temperatures")
         | 
| 37 | 
            +
                        output = gr.Textbox(label="Output", lines=8)
         | 
| 38 | 
            +
                
         | 
| 39 | 
            +
                with gr.Row(variant="panel"):
         | 
| 40 | 
            +
                        clear_btn = gr.Button("Clear")
         | 
| 41 | 
            +
                        submit_btn = gr.Button("Submit", variant="primary")
         | 
| 42 | 
            +
             | 
| 43 | 
            +
             | 
| 44 | 
            +
                submit_btn.click(fn=transcribe, inputs=[input], outputs=[output])
         | 
| 45 | 
            +
                clear_btn.click(fn=clear,inputs=[], outputs=[input], queue=False,)
         | 
| 46 |  | 
|  | |
| 47 |  | 
| 48 | 
             
            if __name__ == "__main__":
         | 
| 49 | 
             
                demo.launch()
         | 
 
			

