Muhammad Abdiel Al Hafiz
commited on
Commit
·
fe44a5a
1
Parent(s):
e68c247
get back to css
Browse files
app.py
CHANGED
|
@@ -64,31 +64,16 @@ example_images = [
|
|
| 64 |
# Custom CSS for HTML height
|
| 65 |
css = """
|
| 66 |
.scrollable-html {
|
| 67 |
-
height: 207px;
|
|
|
|
| 68 |
overflow-y: auto;
|
| 69 |
border: 1px solid #ccc;
|
| 70 |
padding: 10px;
|
| 71 |
box-sizing: border-box;
|
| 72 |
-
transition: height 0.3s ease;
|
| 73 |
}
|
| 74 |
"""
|
| 75 |
|
| 76 |
-
# Custom JavaScript to dynamically adjust height
|
| 77 |
-
js = """
|
| 78 |
-
<script>
|
| 79 |
-
function adjustHeight() {
|
| 80 |
-
const outputElement = document.querySelector('.scrollable-html');
|
| 81 |
-
if (outputElement && outputElement.innerHTML.trim() !== '') {
|
| 82 |
-
outputElement.style.height = '250px';
|
| 83 |
-
} else {
|
| 84 |
-
outputElement.style.height = '207px';
|
| 85 |
-
}
|
| 86 |
-
}
|
| 87 |
-
document.addEventListener('DOMContentLoaded', adjustHeight);
|
| 88 |
-
setInterval(adjustHeight, 1000); // Check every second to adjust height
|
| 89 |
-
</script>
|
| 90 |
-
"""
|
| 91 |
-
|
| 92 |
# Gradio Interface
|
| 93 |
interface = gr.Interface(
|
| 94 |
fn=predict_image,
|
|
@@ -107,5 +92,4 @@ interface = gr.Interface(
|
|
| 107 |
css=css
|
| 108 |
)
|
| 109 |
|
| 110 |
-
|
| 111 |
-
interface.launch(share=True, inline=False, scripts=js)
|
|
|
|
| 64 |
# Custom CSS for HTML height
|
| 65 |
css = """
|
| 66 |
.scrollable-html {
|
| 67 |
+
min-height: 207px;
|
| 68 |
+
max-height: 250px;
|
| 69 |
overflow-y: auto;
|
| 70 |
border: 1px solid #ccc;
|
| 71 |
padding: 10px;
|
| 72 |
box-sizing: border-box;
|
| 73 |
+
transition: max-height 0.3s ease;
|
| 74 |
}
|
| 75 |
"""
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
# Gradio Interface
|
| 78 |
interface = gr.Interface(
|
| 79 |
fn=predict_image,
|
|
|
|
| 92 |
css=css
|
| 93 |
)
|
| 94 |
|
| 95 |
+
interface.launch(share=True)
|
|
|