Spaces:
Sleeping
Sleeping
from nemo import EnigmaEscape | |
from levels import levels | |
import streamlit as st | |
st.set_page_config(page_title="Enigma Escape", page_icon="π") | |
st.title("Enigma Escape") | |
st.subheader("Embark on a linguistic adventure.") | |
st.write( | |
"The game where you guide Bot to say specific phrases with your own cleverly tweaked instructions." | |
"Keep it short and smart - change up the words just enough to pass the test and hit the target phrase." | |
"Ready, set, twist!" | |
) | |
def get_ee(): | |
return EnigmaEscape(levels) | |
with get_ee() as bot: | |
with st.expander("Choose Level >"): | |
bot.set_level(st.radio("Level", options=range(len(levels)), | |
format_func=lambda x: f"{levels[x].name}: {levels[x].points} points")) | |
st.markdown(f"""<h4>Make the bot say the Enigma Phrase <br><span style="color: #ff0000">{ | |
bot.level.phrase}</span><br> to escape this level</h4>""", unsafe_allow_html=True) | |
with st.form("chat"): | |
que = st.text_area("Enter your instructions to Bot: ", height=100) | |
if st.form_submit_button("Send"): | |
with st.container(): | |
with st.spinner("Generating Response..."): | |
resp = bot.chat(que) | |
content, _type = resp["content"], resp["type"] | |
st.write("AI Bot Response: ") | |
if _type == "error": | |
st.error(content) | |
elif _type == "info": | |
st.info(content) | |
elif _type == "warning": | |
st.warning(content) | |
elif _type == "success": | |
st.success(content) | |
st.success(f"hurray! you escaped and gained some points") | |
else: | |
st.write(content) | |