Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,6 +53,35 @@ def fetch_personalized_data(session_index):
|
|
| 53 |
print(f"Error: {err}")
|
| 54 |
return None
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
def get_window_url_params():
|
| 57 |
return """
|
| 58 |
function() {
|
|
@@ -62,7 +91,7 @@ def get_window_url_params():
|
|
| 62 |
}
|
| 63 |
"""
|
| 64 |
|
| 65 |
-
with gr.Blocks(js =
|
| 66 |
gr.Markdown("""## Gradio send queryparam to chatbot
|
| 67 |
type `hi`
|
| 68 |
""")
|
|
|
|
| 53 |
print(f"Error: {err}")
|
| 54 |
return None
|
| 55 |
|
| 56 |
+
js = """
|
| 57 |
+
function createGradioAnimation() {
|
| 58 |
+
var container = document.createElement('div');
|
| 59 |
+
container.id = 'gradio-animation';
|
| 60 |
+
container.style.fontSize = '2em';
|
| 61 |
+
container.style.fontWeight = 'bold';
|
| 62 |
+
container.style.textAlign = 'center';
|
| 63 |
+
container.style.marginBottom = '20px';
|
| 64 |
+
var text = 'Welcome to Gradio!';
|
| 65 |
+
for (var i = 0; i < text.length; i++) {
|
| 66 |
+
(function(i){
|
| 67 |
+
setTimeout(function(){
|
| 68 |
+
var letter = document.createElement('span');
|
| 69 |
+
letter.style.opacity = '0';
|
| 70 |
+
letter.style.transition = 'opacity 0.5s';
|
| 71 |
+
letter.innerText = text[i];
|
| 72 |
+
container.appendChild(letter);
|
| 73 |
+
setTimeout(function() {
|
| 74 |
+
letter.style.opacity = '1';
|
| 75 |
+
}, 50);
|
| 76 |
+
}, i * 250);
|
| 77 |
+
})(i);
|
| 78 |
+
}
|
| 79 |
+
var gradioContainer = document.querySelector('.gradio-container');
|
| 80 |
+
gradioContainer.insertBefore(container, gradioContainer.firstChild);
|
| 81 |
+
return 'Animation created';
|
| 82 |
+
}
|
| 83 |
+
"""
|
| 84 |
+
|
| 85 |
def get_window_url_params():
|
| 86 |
return """
|
| 87 |
function() {
|
|
|
|
| 91 |
}
|
| 92 |
"""
|
| 93 |
|
| 94 |
+
with gr.Blocks(js = js) as demo:
|
| 95 |
gr.Markdown("""## Gradio send queryparam to chatbot
|
| 96 |
type `hi`
|
| 97 |
""")
|