Spaces:
Running
Running
mrfakename
commited on
Commit
•
bace344
0
Parent(s):
Super-squash branch 'main' using huggingface_hub
Browse files- .gitattributes +35 -0
- README.md +14 -0
- app.py +50 -0
- requirements.txt +3 -0
.gitattributes
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Did StyleTTS 2 Generate It?
|
3 |
+
emoji: 🤔
|
4 |
+
colorFrom: yellow
|
5 |
+
colorTo: yellow
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 5.5.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: true
|
10 |
+
short_description: Did StyleTTS 2 generate that audio?!?
|
11 |
+
license: mit
|
12 |
+
---
|
13 |
+
|
14 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
import torch
|
4 |
+
import os
|
5 |
+
|
6 |
+
pipe = pipeline('audio-classification', model='mrfakename/styletts2-detector', device='cuda' if torch.cuda.is_available() else 'cpu')
|
7 |
+
pipe_turbo = pipeline('audio-classification', model='mrfakename/styletts2-detector-turbo', device='cuda' if torch.cuda.is_available() else 'cpu', token=os.getenv('HF_TOKEN'))
|
8 |
+
|
9 |
+
ABOUT = """
|
10 |
+
# 🤔 Did StyleTTS 2 Generate It?
|
11 |
+
|
12 |
+
[Model](https://huggingface.co/mrfakename/styletts2-detector)
|
13 |
+
|
14 |
+
An audio classification model based on Whisper to detect StyleTTS 2 audio. Please share incorrect results in the Community tab!
|
15 |
+
|
16 |
+
**NOTE: Not affiliated with the author(s) of StyleTTS 2 in any way.**
|
17 |
+
"""
|
18 |
+
|
19 |
+
DISCLAIMER = """
|
20 |
+
## Disclaimer
|
21 |
+
|
22 |
+
The author(s) of this model cannot guarantee complete accuracy. False positives or negatives may occur.
|
23 |
+
|
24 |
+
Usage of this model should not replace other precautions, such as invisible watermarking or audio watermarking.
|
25 |
+
|
26 |
+
This model has been trained on outputs from the StyleTTS 2 base model, not fine-tunes. The model may not identify fine-tunes properly.
|
27 |
+
|
28 |
+
The author(s) of this model disclaim all liability related to or in connection with the usage of this model.
|
29 |
+
"""
|
30 |
+
|
31 |
+
def classify(audio, model):
|
32 |
+
if model == "turbo":
|
33 |
+
result = pipe_turbo(audio)
|
34 |
+
else:
|
35 |
+
result = pipe(audio)
|
36 |
+
res = {}
|
37 |
+
for r in result:
|
38 |
+
res[r['label']] = r['score']
|
39 |
+
return res
|
40 |
+
|
41 |
+
with gr.Blocks() as demo:
|
42 |
+
gr.Markdown(ABOUT)
|
43 |
+
aud = gr.Audio(label="Upload audio...", interactive=True, type="filepath")
|
44 |
+
model = gr.Radio(["default", "turbo"], label="Model", info="Which model do you want to use?")
|
45 |
+
btn = gr.Button("Classify", variant="primary")
|
46 |
+
res = gr.Label(label="Results...")
|
47 |
+
btn.click(classify, inputs=aud, outputs=res)
|
48 |
+
gr.Markdown(DISCLAIMER)
|
49 |
+
|
50 |
+
demo.queue(default_concurrency_limit=20, max_size=20, api_open=False).launch(show_api=False)
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
transformers[torch]
|
2 |
+
librosa
|
3 |
+
soundfile
|