Spaces:
Runtime error
Runtime error
| """ | |
| Gradio app setup and launch module | |
| Author: Jakub Polnis | |
| Copyright: Copyright 2025, Jakub Polnis | |
| License: Apache 2.0 | |
| Email: [email protected] | |
| """ | |
| import gradio as gr | |
| from predict import prediction | |
| from transformers import AutoImageProcessor, AutoModelForImageClassification | |
| from functools import partial | |
| title = "Audio deepfake Classification" | |
| description = """This space uses fine-tuned kubinooo/convnext-tiny-224-audio-deepfake-classification model to classify audio files. | |
| """ | |
| processor = AutoImageProcessor.from_pretrained("kubinooo/convnext-tiny-224-audio-deepfake-classification") | |
| model = AutoModelForImageClassification.from_pretrained("kubinooo/convnext-tiny-224-audio-deepfake-classification") | |
| demo = gr.Interface( | |
| title=title, | |
| inputs=gr.Audio( type="filepath", | |
| interactive=True, # This prevents users from uploading their own images | |
| show_label=True, | |
| label="Select from examples below or upload/record your own audio"), | |
| fn=partial(prediction, processor=processor, model=model), | |
| outputs=gr.Label( | |
| num_top_classes=2, | |
| ), | |
| examples=[ | |
| "src/31-MALE-VC-FAKE.wav", | |
| "src/2152-REAL.wav" | |
| ], | |
| description=description | |
| ) | |
| demo.launch() |