Spaces:
Running
Running
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,46 @@ 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 +322,12 @@ 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 = []
|
@@ -258,7 +359,7 @@ def main():
|
|
258 |
</div>
|
259 |
<div style="padding: 1.5rem; background: #f8f9fa; border-radius: 12px;">
|
260 |
<h4 style="margin: 0; color: #6C63FF;">🎯 Object</h4>
|
261 |
-
<p style="margin: 0.5rem 0 0; color: #64748B;">Everyday item, tool, vehicle
|
262 |
</div>
|
263 |
</div>
|
264 |
</div>
|
@@ -430,4 +531,4 @@ def main():
|
|
430 |
st.experimental_rerun()
|
431 |
|
432 |
if __name__ == "__main__":
|
433 |
-
main()
|
|
|
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 |
+
st.markdown("""
|
280 |
+
<div class="info-modal-backdrop" id="infoBackdrop">
|
281 |
+
<div class="info-modal">
|
282 |
+
<button class="close-modal-btn" onclick="document.getElementById('infoBackdrop').style.display='none'">×</button>
|
283 |
+
<h3 style="color: #6C63FF; margin-bottom: 1.5rem; text-align: center;">Project Techniques & Limitations</h3>
|
284 |
+
|
285 |
+
<div class="tech-item">
|
286 |
+
<div class="tech-title"><i class="fas fa-brain"></i> AI Models Used</div>
|
287 |
+
<ul style="color: #64748B; padding-left: 1.2rem;">
|
288 |
+
<li><strong>Groq Llama 3.3-70B</strong> - For generating strategic questions and final guesses</li>
|
289 |
+
<li><strong>Mistral Tiny</strong> - Powers the help chat assistant</li>
|
290 |
+
<li><strong>OpenAI Whisper</strong> - Converts speech to text in real-time</li>
|
291 |
+
<li><strong>Hard Prompt Tuning</strong> - Carefully engineered prompts to optimize model performance for the guessing game</li>
|
292 |
+
</ul>
|
293 |
+
</div>
|
294 |
+
|
295 |
+
<div class="tech-item">
|
296 |
+
<div class="tech-title"><i class="fas fa-exclamation-triangle"></i> Known Limitations</div>
|
297 |
+
<ul style="color: #64748B; padding-left: 1.2rem;">
|
298 |
+
<li>Voice input may take 5-10 seconds to process a sentence (like single-word categories)</li>
|
299 |
+
<li>But voice processing for single words (like "yes", "no", "place") may take 10-20 seconds </li>
|
300 |
+
<li><strong>Language Support</strong> - While Whisper understands and write Urdu, the game currently only supports English responses</li>
|
301 |
+
</ul>
|
302 |
+
</div>
|
303 |
+
|
304 |
+
<div style="text-align: center; margin-top: 1.5rem;">
|
305 |
+
<button onclick="document.getElementById('infoBackdrop').style.display='none'"
|
306 |
+
style="background: #6C63FF; color: white; border: none; padding: 0.5rem 1.5rem; border-radius: 8px; cursor: pointer;">
|
307 |
+
Got It!
|
308 |
+
</button>
|
309 |
+
</div>
|
310 |
+
</div>
|
311 |
+
</div>
|
312 |
+
<script>
|
313 |
+
// Hide modal by default
|
314 |
+
document.getElementById('infoBackdrop').style.display = 'none';
|
315 |
+
</script>
|
316 |
+
""", unsafe_allow_html=True)
|
317 |
######################################
|
318 |
# Main Game Logic with Voice Integration
|
319 |
######################################
|
|
|
322 |
inject_custom_css()
|
323 |
st.markdown('<div class="title">KASOTI</div>', unsafe_allow_html=True)
|
324 |
st.markdown('<div class="subtitle">AI-Powered Guessing Game Challenge</div>', unsafe_allow_html=True)
|
325 |
+
|
326 |
+
if st.button("ℹ️ Project Techniques & Limitations", key="info_btn"):
|
327 |
+
show_techniques_modal()
|
328 |
+
st.experimental_rerun()
|
329 |
+
|
330 |
+
|
331 |
if 'game_state' not in st.session_state:
|
332 |
st.session_state.game_state = "start"
|
333 |
st.session_state.questions = []
|
|
|
359 |
</div>
|
360 |
<div style="padding: 1.5rem; background: #f8f9fa; border-radius: 12px;">
|
361 |
<h4 style="margin: 0; color: #6C63FF;">🎯 Object</h4>
|
362 |
+
<p style="margin: 0.5rem 0 0; color: #64748B;">Everyday item, tool, vehicle</p>
|
363 |
</div>
|
364 |
</div>
|
365 |
</div>
|
|
|
531 |
st.experimental_rerun()
|
532 |
|
533 |
if __name__ == "__main__":
|
534 |
+
main()
|