Spaces:
Sleeping
Sleeping
File size: 1,220 Bytes
c72f44e 52a3e2b c72f44e 8e428da c72f44e 9243a04 b286257 25b6233 5c962af 4eecb41 cfa6fb2 4eecb41 25b6233 b286257 7fb5dd6 9243a04 b5076ca 9243a04 b286257 9243a04 b286257 |
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 31 |
import streamlit as st
#from langchain.llms import OpenAI
from langchain_community.llms import OpenAI
st.title("ask me anything!")
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: 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."
)
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 dipanwita")
submitted = st.form_submit_button("Ask dilip")
if submitted and topic:
post = mathematics(topic)
st.info(post)
elif submitted and not topic:
st.error("Please enter a topic to generate a post.") |