import streamlit as st import requests st.set_page_config( page_title="Virgil Engine | Mathematical Computation", page_icon="🧮", layout="wide", initial_sidebar_state="collapsed" ) st.markdown(""" """, unsafe_allow_html=True) st.title("Virgil Computational Engine") st.markdown("""
Advanced Mathematical Computation & Problem Solving
""", unsafe_allow_html=True) st.markdown("", unsafe_allow_html=True) main_container = st.container() with main_container: left_col, right_col = st.columns([6, 4]) with left_col: st.markdown("### Mathematical Query") mode = st.radio( "Select Computation Mode", options=["Mode 1", "Mode 2"], index=0 ) query = st.text_area( "Math Question", height=150, placeholder="Enter your mathematical expression here...\nExample: Solve x^2 + 2x + 1 = 0", key="query_input" ) if st.button("Solve Expression", type="primary", use_container_width=True): if not query: st.error("Please enter a mathematical expression.") else: try: with st.spinner("Computing solution..."): mode_num = int(mode.split("Mode ")[1]) url = "https://virgil.ruben-roy.com/v1/process" headers = {'Content-Type': 'application/json'} data = {"query": query, "mode": mode_num} response = requests.post( url, json=data, headers=headers, verify=False, timeout=10 ) if response.status_code == 200: result = response.json() st.markdown("#### Solution") st.latex(result['solution']) except requests.exceptions.Timeout: st.error("⚠️ Request timed out. Please try again.") except requests.exceptions.RequestException as e: st.error(f"⚠️ Connection error: {str(e)}") except Exception as e: st.error(f"⚠️ An unexpected error occurred: {str(e)}") with right_col: with st.expander("About Virgil Engine", expanded=True): st.markdown(""" Virgil is a mathematical computation engine designed to solve complex mathematical problems. Developed by Ruben Roy, 2025. """) with st.expander("Computation Modes", expanded=True): st.markdown(""" Virgil has 2 computational modes, they perform differently depending on what you want to do with it. If you get an unexpected or disappointing output from a specific mode, try switching to the other mode. """) with st.expander("How to Use", expanded=True): st.markdown(""" 1. First, select the mode you'd like to use. 2. Then, enter your query and type your mathematical expression 3. Finally click 'Solve Expression' to get your solution Try using clear, standard mathematical notation for the best results. """) st.markdown("---") st.markdown(""" """, unsafe_allow_html=True)