Update app.py
Browse files
app.py
CHANGED
|
@@ -123,6 +123,61 @@ def inject_custom_css():
|
|
| 123 |
transition: width 0.5s ease; }
|
| 124 |
.question-count { color: #6C63FF; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.5rem; }
|
| 125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
</style>
|
| 127 |
""", unsafe_allow_html=True)
|
| 128 |
|
|
@@ -219,6 +274,26 @@ def ask_help_agent(query):
|
|
| 219 |
except Exception as e:
|
| 220 |
return f"Error in help agent: {str(e)}"
|
| 221 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
######################################
|
| 223 |
# Main Game Logic with Voice Integration
|
| 224 |
######################################
|
|
@@ -227,6 +302,11 @@ def main():
|
|
| 227 |
inject_custom_css()
|
| 228 |
st.markdown('<div class="title">KASOTI</div>', unsafe_allow_html=True)
|
| 229 |
st.markdown('<div class="subtitle">AI-Powered Guessing Game Challenge</div>', unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
if 'game_state' not in st.session_state:
|
| 231 |
st.session_state.game_state = "start"
|
| 232 |
st.session_state.questions = []
|
|
|
|
| 123 |
transition: width 0.5s ease; }
|
| 124 |
.question-count { color: #6C63FF; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.5rem; }
|
| 125 |
|
| 126 |
+
|
| 127 |
+
/* Add these new styles for the info modal */
|
| 128 |
+
.info-modal {
|
| 129 |
+
position: fixed;
|
| 130 |
+
top: 50%;
|
| 131 |
+
left: 50%;
|
| 132 |
+
transform: translate(-50%, -50%);
|
| 133 |
+
background: white;
|
| 134 |
+
padding: 2rem;
|
| 135 |
+
border-radius: 20px;
|
| 136 |
+
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
|
| 137 |
+
z-index: 1000;
|
| 138 |
+
max-width: 600px;
|
| 139 |
+
width: 90%;
|
| 140 |
+
max-height: 80vh;
|
| 141 |
+
overflow-y: auto;
|
| 142 |
+
}
|
| 143 |
+
.info-modal-backdrop {
|
| 144 |
+
position: fixed;
|
| 145 |
+
top: 0;
|
| 146 |
+
left: 0;
|
| 147 |
+
right: 0;
|
| 148 |
+
bottom: 0;
|
| 149 |
+
background: rgba(0,0,0,0.5);
|
| 150 |
+
z-index: 999;
|
| 151 |
+
}
|
| 152 |
+
.tech-item {
|
| 153 |
+
margin-bottom: 1.5rem;
|
| 154 |
+
padding-bottom: 1.5rem;
|
| 155 |
+
border-bottom: 1px solid #e2e8f0;
|
| 156 |
+
}
|
| 157 |
+
.tech-item:last-child {
|
| 158 |
+
border-bottom: none;
|
| 159 |
+
margin-bottom: 0;
|
| 160 |
+
padding-bottom: 0;
|
| 161 |
+
}
|
| 162 |
+
.tech-title {
|
| 163 |
+
color: #6C63FF;
|
| 164 |
+
font-weight: 600;
|
| 165 |
+
margin-bottom: 0.5rem;
|
| 166 |
+
display: flex;
|
| 167 |
+
align-items: center;
|
| 168 |
+
gap: 0.5rem;
|
| 169 |
+
}
|
| 170 |
+
.close-modal-btn {
|
| 171 |
+
position: absolute;
|
| 172 |
+
top: 1rem;
|
| 173 |
+
right: 1rem;
|
| 174 |
+
background: none;
|
| 175 |
+
border: none;
|
| 176 |
+
font-size: 1.5rem;
|
| 177 |
+
cursor: pointer;
|
| 178 |
+
color: #64748B;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
</style>
|
| 182 |
""", unsafe_allow_html=True)
|
| 183 |
|
|
|
|
| 274 |
except Exception as e:
|
| 275 |
return f"Error in help agent: {str(e)}"
|
| 276 |
|
| 277 |
+
|
| 278 |
+
def show_techniques_modal():
|
| 279 |
+
# Use Streamlit's expander with markdown
|
| 280 |
+
with st.expander("ℹ️ Project Techniques & Limitations", expanded=True):
|
| 281 |
+
st.markdown("""
|
| 282 |
+
**AI Models Used:**
|
| 283 |
+
1. Groq Llama 3.3-70B - For generating strategic questions and final guesses
|
| 284 |
+
2. Mistral Tiny - Powers the help chat assistant
|
| 285 |
+
3. OpenAI Whisper - Converts speech to text in real-time
|
| 286 |
+
4. Hard Prompt Tuning - Carefully engineered prompts to optimize model performance
|
| 287 |
+
|
| 288 |
+
**Known Limitations:**
|
| 289 |
+
1. Voice input may take 5-10 seconds to process sentences, which is fine.
|
| 290 |
+
2. Single words (like "yes", "object") may take 10-20 minutes, which is irritating.
|
| 291 |
+
3. Language Support - While Whisper understands and writes Urdu, but the game only supports English responses
|
| 292 |
+
""")
|
| 293 |
+
|
| 294 |
+
if st.button("Close", key="modal_close_btn"):
|
| 295 |
+
pass # The expander will automatically close
|
| 296 |
+
|
| 297 |
######################################
|
| 298 |
# Main Game Logic with Voice Integration
|
| 299 |
######################################
|
|
|
|
| 302 |
inject_custom_css()
|
| 303 |
st.markdown('<div class="title">KASOTI</div>', unsafe_allow_html=True)
|
| 304 |
st.markdown('<div class="subtitle">AI-Powered Guessing Game Challenge</div>', unsafe_allow_html=True)
|
| 305 |
+
|
| 306 |
+
if st.button("ℹ️ Project Techniques & Limitations", key="info_btn"):
|
| 307 |
+
show_techniques_modal()
|
| 308 |
+
|
| 309 |
+
|
| 310 |
if 'game_state' not in st.session_state:
|
| 311 |
st.session_state.game_state = "start"
|
| 312 |
st.session_state.questions = []
|