File size: 1,453 Bytes
8959f8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

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.
""")