Upload 2 files
Browse files- app.py +33 -0
- sample.png +0 -0
app.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import skimage
|
4 |
+
|
5 |
+
learn = load_learner('jha2ee/riffusion-model-v1')
|
6 |
+
labels = learn.dls.vocab
|
7 |
+
|
8 |
+
|
9 |
+
def predict(img):
|
10 |
+
img = PILImage.create(img)
|
11 |
+
pred, pred_idx, probs = learn.predict(img)
|
12 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
13 |
+
|
14 |
+
|
15 |
+
title = "StableDiffusion_SoundFX"
|
16 |
+
description = "Generate sound FX"
|
17 |
+
article = "<p style='text-align: center'><a href='https://huggingface.co/riffusion/riffusion-model-v1' " \
|
18 |
+
"target='_blank'>Blog post</a></p> "
|
19 |
+
examples = ['sample.jpeg']
|
20 |
+
interpretation = 'default'
|
21 |
+
enable_queue = True
|
22 |
+
|
23 |
+
gr.Interface(
|
24 |
+
fn=predict,
|
25 |
+
inputs=gr.inputs.Image(shape=(512, 512)),
|
26 |
+
outputs=gr.outputs.Label(num_top_classes=3),
|
27 |
+
title=title,
|
28 |
+
description=description,
|
29 |
+
article=article,
|
30 |
+
examples=examples,
|
31 |
+
interpretation=interpretation,
|
32 |
+
enable_queue=enable_queue
|
33 |
+
).launch()
|
sample.png
ADDED