Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import numpy as np
|
3 |
-
import random
|
4 |
|
5 |
# import spaces #[uncomment to use ZeroGPU]
|
6 |
-
from diffusers import DiffusionPipeline
|
7 |
import torch
|
8 |
|
9 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
@@ -50,52 +48,10 @@ def infer(
|
|
50 |
|
51 |
return image, seed
|
52 |
|
53 |
-
|
54 |
-
examples = [
|
55 |
-
"Astronaut in a jungle, cold color palette, muted colors, detailed, 8k",
|
56 |
-
"An astronaut riding a green horse",
|
57 |
-
"A delicious ceviche cheesecake slice",
|
58 |
-
]
|
59 |
-
|
60 |
-
css = """
|
61 |
-
#col-container {
|
62 |
-
margin: 0 auto;
|
63 |
-
max-width: 640px;
|
64 |
-
}
|
65 |
-
"""
|
66 |
-
|
67 |
with gr.Blocks(css=css) as demo:
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
with gr.Row():
|
72 |
-
prompt = gr.Text(
|
73 |
-
label="Prompt",
|
74 |
-
show_label=False,
|
75 |
-
max_lines=1,
|
76 |
-
placeholder="Enter your prompt",
|
77 |
-
container=False,
|
78 |
-
)
|
79 |
-
|
80 |
-
run_button = gr.Button("Run", scale=0, variant="primary")
|
81 |
-
|
82 |
-
result = gr.Image(label="Result", show_label=False)
|
83 |
-
|
84 |
-
gr.Examples(examples=examples, inputs=[prompt])
|
85 |
-
gr.on(
|
86 |
-
triggers=[run_button.click, prompt.submit],
|
87 |
-
fn=infer,
|
88 |
-
inputs=[
|
89 |
-
prompt,
|
90 |
-
negative_prompt,
|
91 |
-
seed,
|
92 |
-
randomize_seed,
|
93 |
-
width,
|
94 |
-
height,
|
95 |
-
guidance_scale,
|
96 |
-
num_inference_steps,
|
97 |
-
],
|
98 |
-
outputs=[result, seed],
|
99 |
)
|
100 |
|
101 |
if __name__ == "__main__":
|
|
|
1 |
import gradio as gr
|
2 |
import numpy as np
|
|
|
3 |
|
4 |
# import spaces #[uncomment to use ZeroGPU]
|
|
|
5 |
import torch
|
6 |
|
7 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
48 |
|
49 |
return image, seed
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
with gr.Blocks(css=css) as demo:
|
52 |
+
gr.Markdown(" # PhonoLearn")
|
53 |
+
input_audio = gr.Audio(
|
54 |
+
sources=["microphone", "upload"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
)
|
56 |
|
57 |
if __name__ == "__main__":
|