Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,75 +5,12 @@ client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
|
5 |
|
6 |
# Background effect from CodePen
|
7 |
background_html = """
|
8 |
-
<style>
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
}
|
15 |
-
|
16 |
-
.canvas-container {
|
17 |
-
position: absolute;
|
18 |
-
top: 0;
|
19 |
-
left: 0;
|
20 |
-
right: 0;
|
21 |
-
bottom: 0;
|
22 |
-
z-index: -1;
|
23 |
-
display: flex;
|
24 |
-
justify-content: center;
|
25 |
-
align-items: center;
|
26 |
-
}
|
27 |
-
|
28 |
-
canvas {
|
29 |
-
display: block;
|
30 |
-
width: 100%;
|
31 |
-
height: 100%;
|
32 |
-
}
|
33 |
-
</style>
|
34 |
-
|
35 |
-
<div class="canvas-container">
|
36 |
-
<canvas id="background-effect"></canvas>
|
37 |
-
</div>
|
38 |
-
|
39 |
-
<script>
|
40 |
-
const canvas = document.getElementById('background-effect');
|
41 |
-
const ctx = canvas.getContext('2d');
|
42 |
-
|
43 |
-
function resizeCanvas() {
|
44 |
-
canvas.width = window.innerWidth;
|
45 |
-
canvas.height = window.innerHeight;
|
46 |
-
}
|
47 |
-
window.addEventListener('resize', resizeCanvas);
|
48 |
-
resizeCanvas();
|
49 |
-
|
50 |
-
function randomInt(min, max) {
|
51 |
-
return Math.floor(Math.random() * (max - min + 1)) + min;
|
52 |
-
}
|
53 |
-
|
54 |
-
function drawBackground() {
|
55 |
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
56 |
-
|
57 |
-
for (let i = 0; i < 100; i++) {
|
58 |
-
const x = randomInt(0, canvas.width);
|
59 |
-
const y = randomInt(0, canvas.height);
|
60 |
-
const radius = randomInt(1, 5);
|
61 |
-
const r = randomInt(0, 255);
|
62 |
-
const g = randomInt(0, 255);
|
63 |
-
const b = randomInt(0, 255);
|
64 |
-
const alpha = Math.random();
|
65 |
-
|
66 |
-
ctx.beginPath();
|
67 |
-
ctx.arc(x, y, radius, 0, Math.PI * 2, false);
|
68 |
-
ctx.fillStyle = `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
69 |
-
ctx.fill();
|
70 |
-
}
|
71 |
-
|
72 |
-
requestAnimationFrame(drawBackground);
|
73 |
-
}
|
74 |
-
|
75 |
-
drawBackground();
|
76 |
-
</script>
|
77 |
"""
|
78 |
|
79 |
def respond(
|
|
|
5 |
|
6 |
# Background effect from CodePen
|
7 |
background_html = """
|
8 |
+
<p class="codepen" data-height="300" data-theme-id="dark" data-default-tab="html,result" data-slug-hash="LYwLqVv" data-pen-title="WebGL Eye Pattern" data-user="bxck75" style="height: 300px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;">
|
9 |
+
<span>See the Pen <a href="https://codepen.io/bxck75/pen/LYwLqVv">
|
10 |
+
WebGL Eye Pattern</a> by boudewijn (<a href="https://codepen.io/bxck75">@bxck75</a>)
|
11 |
+
on <a href="https://codepen.io">CodePen</a>.</span>
|
12 |
+
</p>
|
13 |
+
<script async src="https://cpwebassets.codepen.io/assets/embed/ei.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
"""
|
15 |
|
16 |
def respond(
|