Spaces:
Running
Running
File size: 1,106 Bytes
c72f44e 52a3e2b c72f44e 5650c41 c72f44e 493a6ce b286257 493a6ce c0d5884 86f6329 328c45e 789664c 328c45e b286257 493a6ce 5770062 493a6ce 863b3be b286257 493a6ce b286257 6677c09 |
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 |
import streamlit as st
#from langchain.llms import OpenAI
from langchain_community.llms import OpenAI
st.title("Maths Problem Solving with Adolina!")
def mathematics(topic):
# Enhanced prompt with additional context for better post generation
prompt =(
f"solve this :{topic} as a CBSE Board Mathematics Teacher, you need to provide solutions for the questions asked in the following format:"
"1. Problem Statement: State the problem clearly."
"2. Solution Approach: Solve as per CBSE guidelines."
"3. Step-by-Step Solution: Show the method of solution."
"4. Final Answer: Clearly present the final answer, with any necessary units or explanations."
)
llm = OpenAI(temperature=0.7, openai_api_key=st.secrets["OPENAI_API_KEY"])
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.") |