Spaces:
Running
Running
Commit
·
19b8053
1
Parent(s):
30fe54d
Add application files
Browse files
app.py
CHANGED
@@ -78,6 +78,15 @@ def greet(name1, name2):
|
|
78 |
df_pred.to_csv(temp_file.name, index=False)
|
79 |
csv_output = temp_file.name
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
# Create a button to toggle table view and a script to handle the button click
|
82 |
show_more_button = """
|
83 |
<button onclick="toggleTableView()">Show More</button>
|
@@ -86,7 +95,7 @@ def greet(name1, name2):
|
|
86 |
function toggleTableView() {
|
87 |
var table = document.getElementById('output-table');
|
88 |
var rows = table.getElementsByTagName('tr');
|
89 |
-
for (var i =
|
90 |
if (isFullTableShown) {
|
91 |
rows[i].style.display = 'none';
|
92 |
} else {
|
@@ -99,11 +108,9 @@ def greet(name1, name2):
|
|
99 |
</script>
|
100 |
"""
|
101 |
|
102 |
-
#
|
103 |
-
html_output =
|
104 |
|
105 |
-
# Combine the HTML table and the Show More button
|
106 |
-
html_output += show_more_button
|
107 |
|
108 |
|
109 |
return html_output, csv_output
|
|
|
78 |
df_pred.to_csv(temp_file.name, index=False)
|
79 |
csv_output = temp_file.name
|
80 |
|
81 |
+
# Add CSS to hide rows beyond the 15th row initially
|
82 |
+
initial_css = """
|
83 |
+
<style>
|
84 |
+
#output-table tr:nth-child(n+16) {
|
85 |
+
display: none;
|
86 |
+
}
|
87 |
+
</style>
|
88 |
+
"""
|
89 |
+
|
90 |
# Create a button to toggle table view and a script to handle the button click
|
91 |
show_more_button = """
|
92 |
<button onclick="toggleTableView()">Show More</button>
|
|
|
95 |
function toggleTableView() {
|
96 |
var table = document.getElementById('output-table');
|
97 |
var rows = table.getElementsByTagName('tr');
|
98 |
+
for (var i = 16; i < rows.length; i++) {
|
99 |
if (isFullTableShown) {
|
100 |
rows[i].style.display = 'none';
|
101 |
} else {
|
|
|
108 |
</script>
|
109 |
"""
|
110 |
|
111 |
+
# Combine the HTML table, the initial CSS, and the Show More button
|
112 |
+
html_output = initial_css + html_output + show_more_button
|
113 |
|
|
|
|
|
114 |
|
115 |
|
116 |
return html_output, csv_output
|