Spaces:
Running
Running
app.py
CHANGED
|
@@ -21,6 +21,47 @@ rules_gui = f"""
|
|
| 21 |
"""
|
| 22 |
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
def respond(
|
| 26 |
message,
|
|
@@ -72,6 +113,7 @@ demo = gr.ChatInterface(
|
|
| 72 |
label="Top-p (nucleus sampling)",
|
| 73 |
),
|
| 74 |
],
|
|
|
|
| 75 |
)
|
| 76 |
|
| 77 |
|
|
|
|
| 21 |
"""
|
| 22 |
|
| 23 |
|
| 24 |
+
js = """
|
| 25 |
+
function createGradioAnimation() {
|
| 26 |
+
var container = document.createElement('div');
|
| 27 |
+
container.id = 'gradio-animation';
|
| 28 |
+
container.style.fontSize = '2em';
|
| 29 |
+
container.style.fontWeight = 'bold';
|
| 30 |
+
container.style.textAlign = 'center';
|
| 31 |
+
container.style.marginBottom = '20px';
|
| 32 |
+
|
| 33 |
+
var text = 'Olá GUI!';
|
| 34 |
+
for (var i = 0; i < text.length; i++) {
|
| 35 |
+
(function(i){
|
| 36 |
+
setTimeout(function(){
|
| 37 |
+
var letter = document.createElement('span');
|
| 38 |
+
letter.style.opacity = '0';
|
| 39 |
+
letter.style.transition = 'opacity 0.5s';
|
| 40 |
+
letter.innerText = text[i];
|
| 41 |
+
|
| 42 |
+
container.appendChild(letter);
|
| 43 |
+
|
| 44 |
+
setTimeout(function() {
|
| 45 |
+
letter.style.opacity = '1';
|
| 46 |
+
}, 50);
|
| 47 |
+
}, i * 250);
|
| 48 |
+
})(i);
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
var gradioContainer = document.querySelector('.gradio-container');
|
| 52 |
+
gradioContainer.insertBefore(container, gradioContainer.firstChild);
|
| 53 |
+
alert('Olá');
|
| 54 |
+
|
| 55 |
+
document.querySelector('.show-api.svelte-1rjryqp').style.display = 'none';
|
| 56 |
+
document.querySelector('.built-with.svelte-1rjryqp').style.display = 'none';
|
| 57 |
+
document.querySelector('#component-0 textarea[data-testid="textbox"]').style.display = 'none';
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
return 'Animation created';
|
| 61 |
+
}
|
| 62 |
+
"""
|
| 63 |
+
|
| 64 |
+
|
| 65 |
|
| 66 |
def respond(
|
| 67 |
message,
|
|
|
|
| 113 |
label="Top-p (nucleus sampling)",
|
| 114 |
),
|
| 115 |
],
|
| 116 |
+
js=js,
|
| 117 |
)
|
| 118 |
|
| 119 |
|