File size: 1,080 Bytes
16f4a6c | 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 | 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.")
|