circulartext commited on
Commit
3936a00
1 Parent(s): 8a016c0

Create index.html

Browse files
Files changed (1) hide show
  1. index.html +69 -0
index.html ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Text-to-Image Gradio Template</title>
7
+ <script src="https://cdn.jsdelivr.net/npm/@gradio/core@2.1.5/dist/gradio.min.js"></script>
8
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@gradio/core@2.1.5/dist/gradio.min.css">
9
+ <style>
10
+ #col-container {
11
+ margin: 0 auto;
12
+ max-width: 520px;
13
+ }
14
+ </style>
15
+ </head>
16
+ <body>
17
+ <div id="gradio-app"></div>
18
+ <script>
19
+ const { gr, gradio } = window;
20
+
21
+ const MAX_SEED = 2147483647; // Max seed for np.int32
22
+ const MAX_IMAGE_SIZE = 1024;
23
+
24
+ // Your Python function for inference
25
+ const infer = gr.pythonFunction({
26
+ functionAddress: 'somewhere',
27
+ returnType: 'numpy',
28
+ functionArgs: ['prompt', 'negative_prompt', 'seed', 'randomize_seed', 'width', 'height', 'guidance_scale', 'num_inference_steps']
29
+ });
30
+
31
+ const examples = [
32
+ "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k",
33
+ "An astronaut riding a green horse",
34
+ "A delicious ceviche cheesecake slice",
35
+ ];
36
+
37
+ const demo = gr.Interface(
38
+ infer,
39
+ gr.Blocks,
40
+ () => ({
41
+ elem_id: "col-container",
42
+ examples: examples,
43
+ inputs: [
44
+ gr.Text({label: "Prompt", show_label: false, maxLines: 1, placeholder: "Enter your prompt", container: false}),
45
+ gr.Button("Run", {scale: 0})
46
+ ],
47
+ outputs: gr.Image({label: "Result", show_label: false}),
48
+ advanced: [
49
+ gr.Accordion("Advanced Settings", false, [
50
+ gr.Text({label: "Negative prompt", maxLines: 1, placeholder: "Enter a negative prompt", visible: false}),
51
+ gr.Slider({label: "Seed", min: 0, max: MAX_SEED, step: 1, value: 0}),
52
+ gr.Checkbox("Randomize seed", true),
53
+ gr.Row([
54
+ gr.Slider({label: "Width", min: 256, max: MAX_IMAGE_SIZE, step: 32, value: 512}),
55
+ gr.Slider({label: "Height", min: 256, max: MAX_IMAGE_SIZE, step: 32, value: 512})
56
+ ]),
57
+ gr.Row([
58
+ gr.Slider({label: "Guidance scale", min: 0.0, max: 10.0, step: 0.1, value: 0.0}),
59
+ gr.Slider({label: "Number of inference steps", min: 1, max: 12, step: 1, value: 2})
60
+ ])
61
+ ])
62
+ ]
63
+ })
64
+ );
65
+
66
+ demo.render(document.getElementById("gradio-app"));
67
+ </script>
68
+ </body>
69
+ </html>