Teapack1 commited on
Commit
b44551d
1 Parent(s): 8b5a01c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -10
app.py CHANGED
@@ -1,13 +1,18 @@
1
- import gradio as gr
2
 
3
- description = "Story generation with GPT-2"
4
- title = "Generate your own story"
5
- examples = [["Adventurer is approached by a mysterious stranger in the tavern for a new quest."]]
6
 
7
- interface = gr.Interface.load("huggingface/pranavpsv/gpt2-genre-story-generator",
8
- description=description,
9
- examples=examples,
10
- live=True,
11
- )
 
12
 
13
- interface.launch()
 
 
 
 
 
 
1
+ from transformers import pipeline
2
 
3
+ model_id = "sanchit-gandhi/distilhubert-finetuned-gtzan"
4
+ pipe = pipeline("audio-classification", model=model_id)
 
5
 
6
+ def classify_audio(filepath):
7
+ preds = pipe(filepath)
8
+ outputs = {}
9
+ for p in preds:
10
+ outputs[p["label"]] = p["score"]
11
+ return outputs
12
 
13
+ import gradio as gr
14
+
15
+ demo = gr.Interface(
16
+ fn=classify_audio, inputs=gr.Audio(type="filepath"), outputs=gr.outputs.Label()
17
+ )
18
+ demo.launch(debug=True)