sairaishaq commited on
Commit
40fcb4b
·
verified ·
1 Parent(s): 0655436

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -0
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from groq_client import analyze_reaction
3
+
4
+ st.set_page_config(page_title="AI Reaction Outcome Analyzer", layout="centered")
5
+
6
+ st.title("🧪 AI Reaction Outcome Analyzer")
7
+ st.caption("Educational prototype • Uses free Groq LLM • Not for industrial use")
8
+
9
+ with st.form("reaction_form"):
10
+ reactants = st.text_input(
11
+ "Reactants (comma-separated)",
12
+ placeholder="e.g., Ethanol, Potassium dichromate"
13
+ )
14
+ reagents = st.text_input(
15
+ "Reagents / Catalysts",
16
+ placeholder="e.g., H2SO4"
17
+ )
18
+ conditions = st.text_input(
19
+ "Reaction Conditions",
20
+ placeholder="e.g., Acidic medium, reflux"
21
+ )
22
+ submitted = st.form_submit_button("Analyze Reaction")
23
+
24
+ if submitted:
25
+ if not reactants.strip():
26
+ st.error("Please provide at least one reactant.")
27
+ else:
28
+ with st.spinner("Analyzing reaction using AI reasoning..."):
29
+ try:
30
+ result = analyze_reaction(
31
+ reactants=reactants,
32
+ reagents=reagents,
33
+ conditions=conditions
34
+ )
35
+ st.markdown(result)
36
+ except Exception as e:
37
+ st.error("An error occurred while analyzing the reaction.")
38
+ st.exception(e)
39
+
40
+ st.markdown("""---
41
+ **Disclaimer:**
42
+ This tool is for **educational purposes only**.
43
+ Predictions are based on conceptual reasoning, not laboratory validation.
44
+ """)
45
+