che-analyzer / app.py
haris018's picture
Create app.py
8959f8a verified
import streamlit as st
from groq_client import analyze_reaction
st.set_page_config(page_title="AI Reaction Outcome Analyzer", layout="centered")
st.title("🧪 AI Reaction Outcome Analyzer")
st.caption("Educational prototype • Uses free Groq LLM • Not for industrial use")
with st.form("reaction_form"):
reactants = st.text_input(
"Reactants (comma-separated)",
placeholder="e.g., Ethanol, Potassium dichromate"
)
reagents = st.text_input(
"Reagents / Catalysts",
placeholder="e.g., H2SO4"
)
conditions = st.text_input(
"Reaction Conditions",
placeholder="e.g., Acidic medium, reflux"
)
submitted = st.form_submit_button("Analyze Reaction")
if submitted:
if not reactants.strip():
st.error("Please provide at least one reactant.")
else:
with st.spinner("Analyzing reaction using AI reasoning..."):
try:
result = analyze_reaction(
reactants=reactants,
reagents=reagents,
conditions=conditions
)
st.markdown(result)
except Exception as e:
st.error("An error occurred while analyzing the reaction.")
st.exception(e)
st.markdown("""---
**Disclaimer:**
This tool is for **educational purposes only**.
Predictions are based on conceptual reasoning, not laboratory validation.
""")