Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,20 @@
|
|
| 1 |
-
from huggingface_hub import InferenceClient
|
| 2 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
|
|
|
| 4 |
client = InferenceClient(
|
| 5 |
model="mo-thecreator/Deepfake-audio-detection",
|
| 6 |
-
token=
|
| 7 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from huggingface_hub import InferenceClient
|
| 4 |
+
|
| 5 |
+
# Get token from the environment (this will come from Hugging Face Secrets)
|
| 6 |
+
HF_TOKEN = os.getenv("HUGGINGFACEHUB_API_TOKEN")
|
| 7 |
|
| 8 |
+
# Authenticated client for a private or gated model
|
| 9 |
client = InferenceClient(
|
| 10 |
model="mo-thecreator/Deepfake-audio-detection",
|
| 11 |
+
token=HF_TOKEN
|
| 12 |
)
|
| 13 |
+
|
| 14 |
+
def analyze_audio(audio):
|
| 15 |
+
with open(audio, "rb") as f:
|
| 16 |
+
result = client.audio_classification(f)
|
| 17 |
+
return result[0]['label']
|
| 18 |
+
|
| 19 |
+
interface = gr.Interface(fn=analyze_audio, inputs="audio", outputs="text")
|
| 20 |
+
interface.launch()
|