Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,99 +19,32 @@ def load_model(model_name, model_class, is_bc=False):
|
|
| 19 |
# Set up page configuration
|
| 20 |
st.set_page_config(page_title="SemViQA Demo", layout="wide")
|
| 21 |
|
| 22 |
-
# Custom CSS
|
| 23 |
st.markdown(
|
| 24 |
"""
|
| 25 |
<style>
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
overflow: hidden;
|
| 30 |
-
}
|
| 31 |
-
.main-container {
|
| 32 |
-
height: calc(100vh - 55px); /* Browser height - 55px */
|
| 33 |
-
overflow-y: auto;
|
| 34 |
-
padding: 20px;
|
| 35 |
-
}
|
| 36 |
-
.big-title {
|
| 37 |
-
font-size: 36px;
|
| 38 |
-
font-weight: bold;
|
| 39 |
-
color: #4A90E2;
|
| 40 |
-
text-align: center;
|
| 41 |
-
margin-top: 20px;
|
| 42 |
-
position: sticky; /* Pin the header */
|
| 43 |
top: 0;
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
.sub-title {
|
| 48 |
-
font-size: 20px;
|
| 49 |
-
color: #666;
|
| 50 |
-
text-align: center;
|
| 51 |
-
margin-bottom: 20px;
|
| 52 |
-
}
|
| 53 |
-
.stButton>button {
|
| 54 |
-
background-color: #4CAF50;
|
| 55 |
-
color: white;
|
| 56 |
-
font-size: 16px;
|
| 57 |
-
width: 100%;
|
| 58 |
-
border-radius: 8px;
|
| 59 |
-
padding: 10px;
|
| 60 |
-
}
|
| 61 |
-
.stTextArea textarea {
|
| 62 |
-
font-size: 16px;
|
| 63 |
-
min-height: 120px;
|
| 64 |
-
}
|
| 65 |
-
.result-box {
|
| 66 |
-
background-color: #f9f9f9;
|
| 67 |
-
padding: 20px;
|
| 68 |
-
border-radius: 10px;
|
| 69 |
-
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
|
| 70 |
-
margin-top: 20px;
|
| 71 |
-
}
|
| 72 |
-
.verdict {
|
| 73 |
-
font-size: 24px;
|
| 74 |
-
font-weight: bold;
|
| 75 |
-
margin: 0;
|
| 76 |
-
display: flex;
|
| 77 |
-
align-items: center;
|
| 78 |
-
}
|
| 79 |
-
.verdict-icon {
|
| 80 |
-
margin-right: 10px;
|
| 81 |
-
}
|
| 82 |
-
/* Fix the tabs at the top */
|
| 83 |
-
div[data-baseweb="tab-list"] {
|
| 84 |
-
position: sticky;
|
| 85 |
-
top: 55px; /* Height of the header */
|
| 86 |
-
background-color: white;
|
| 87 |
-
z-index: 99;
|
| 88 |
-
}
|
| 89 |
-
/* Fix the sidebar content */
|
| 90 |
-
.stSidebar .sidebar-content {
|
| 91 |
-
background-color: #f0f2f6;
|
| 92 |
-
padding: 20px;
|
| 93 |
-
border-radius: 10px;
|
| 94 |
-
position: sticky;
|
| 95 |
-
top: 55px; /* Height of the header */
|
| 96 |
-
height: calc(100vh - 75px); /* Adjust height to fit within the viewport */
|
| 97 |
-
overflow-y: auto; /* Enable scrolling within the sidebar if content is too long */
|
| 98 |
-
}
|
| 99 |
-
.stSidebar .st-expander {
|
| 100 |
-
background-color: #ffffff;
|
| 101 |
-
border-radius: 10px;
|
| 102 |
-
padding: 10px;
|
| 103 |
-
margin-bottom: 10px;
|
| 104 |
-
}
|
| 105 |
-
.stSidebar .stSlider {
|
| 106 |
-
margin-bottom: 20px;
|
| 107 |
-
}
|
| 108 |
-
.stSidebar .stSelectbox {
|
| 109 |
-
margin-bottom: 20px;
|
| 110 |
}
|
| 111 |
-
|
| 112 |
-
|
|
|
|
| 113 |
}
|
| 114 |
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
""",
|
| 116 |
unsafe_allow_html=True,
|
| 117 |
)
|
|
|
|
| 19 |
# Set up page configuration
|
| 20 |
st.set_page_config(page_title="SemViQA Demo", layout="wide")
|
| 21 |
|
| 22 |
+
# Custom CSS and JavaScript to make the sidebar sticky
|
| 23 |
st.markdown(
|
| 24 |
"""
|
| 25 |
<style>
|
| 26 |
+
/* Fix the sidebar */
|
| 27 |
+
.stSidebar {
|
| 28 |
+
position: fixed;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
top: 0;
|
| 30 |
+
height: 100vh;
|
| 31 |
+
overflow-y: auto;
|
| 32 |
+
z-index: 1000;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
}
|
| 34 |
+
/* Adjust main content to avoid overlap with the fixed sidebar */
|
| 35 |
+
.main .block-container {
|
| 36 |
+
margin-left: 25rem; /* Adjust this value based on your sidebar width */
|
| 37 |
}
|
| 38 |
</style>
|
| 39 |
+
<script>
|
| 40 |
+
// JavaScript to make the sidebar sticky
|
| 41 |
+
window.addEventListener('scroll', function() {
|
| 42 |
+
const sidebar = document.querySelector('.stSidebar');
|
| 43 |
+
if (sidebar) {
|
| 44 |
+
sidebar.style.top = `${window.scrollY}px`;
|
| 45 |
+
}
|
| 46 |
+
});
|
| 47 |
+
</script>
|
| 48 |
""",
|
| 49 |
unsafe_allow_html=True,
|
| 50 |
)
|