Spaces:
Sleeping
Sleeping
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 =( | |
fAs 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**: Explain how you plan to solve the problem or the methodology you'll use. | |
3. **Step-by-Step Solution**: Provide a detailed, step-by-step solution, showing all the calculations or processes involved. | |
4. **Final Answer**: Clearly present the final answer, with any necessary units or explanations. | |
Please provide the questions you need assistance with, and I'll help you solve them using this format." solve this : | |
) | |
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 Spot") | |
if submitted and topic: | |
post = mathematics(topic) | |
st.info(post) | |
elif submitted and not topic: | |
st.error("Give me problems.") |