haris018 commited on
Commit
8959f8a
·
verified ·
1 Parent(s): 20c2cd7

Create app.py

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