import streamlit as st from langchain_community.llms import OpenAI st.title("Maths Problem Solving with Adolina!") def mathematics(topic): prompt = ( f"Solve this: {topic} as a CBSE Board Mathematics Teacher. " "You need to provide solutions for the questions asked in the following format:\n\n" "1. Problem Statement: State the problem clearly.\n" "2. Solution Approach: Solve as per CBSE guidelines.\n" "3. Step-by-Step Solution: Show the method of solution.\n" "4. Final Answer: Clearly present the final answer, with any necessary units or explanations." ) llm = OpenAI(temperature=0.7, openai_api_key=st.secrets["sk-proj-q7ZheuD9p1QQ9zdOFcesT3BlbkFJ8zIk4TSUwCDpYrOIk0nV"]) response = llm(prompt) return response with st.form("my_form"): topic = st.text_area("Mathematics with Adolina") submitted = st.form_submit_button("Ask to Spot") if submitted and topic: post = mathematics(topic) st.info(post) elif submitted and not topic: st.error("Give me problems.")