Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,28 +3,26 @@ import streamlit as st
|
|
3 |
from langchain_community.llms import OpenAI
|
4 |
|
5 |
|
6 |
-
st.title("
|
7 |
|
8 |
-
def
|
9 |
# Enhanced prompt with additional context for better post generation
|
10 |
-
prompt =
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
"It should provide value, insights, or thought-provoking content related to the topic. "
|
16 |
-
"And only contain 3 points."
|
17 |
-
"The tone should be positive and encouraging, suitable for networking and professional growth."
|
18 |
)
|
19 |
llm = OpenAI(temperature=0.7, openai_api_key=st.secrets["OPENAI_API_KEY"])
|
20 |
response = llm(prompt)
|
21 |
return response
|
22 |
|
23 |
-
with st.form("my_form"):
|
24 |
-
topic = st.text_area("
|
25 |
-
|
|
|
26 |
if submitted and topic:
|
27 |
-
post =
|
28 |
st.info(post)
|
29 |
elif submitted and not topic:
|
30 |
st.error("Please enter a topic to generate a post.")
|
|
|
3 |
from langchain_community.llms import OpenAI
|
4 |
|
5 |
|
6 |
+
st.title("ask me anything!")
|
7 |
|
8 |
+
def mathematics(topic):
|
9 |
# Enhanced prompt with additional context for better post generation
|
10 |
+
prompt =(
|
11 |
+
f"Calculate cost based on unit rate."
|
12 |
+
"Example: 20 chocolates for Rs 320. Find cost for 35 chocolates."
|
13 |
+
"Format: Given: 20 chocolates = Rs 320. Cost per chocolate = (320/20)."
|
14 |
+
"Cost for 35 = (320/20) × 35 = Rs 560.solve this {topic}"
|
|
|
|
|
|
|
15 |
)
|
16 |
llm = OpenAI(temperature=0.7, openai_api_key=st.secrets["OPENAI_API_KEY"])
|
17 |
response = llm(prompt)
|
18 |
return response
|
19 |
|
20 |
+
with st.form("my_form"):
|
21 |
+
topic = st.text_area("mathematics with dipanwita")
|
22 |
+
|
23 |
+
submitted = st.form_submit_button("Ask dilip")
|
24 |
if submitted and topic:
|
25 |
+
post = mathematics(topic)
|
26 |
st.info(post)
|
27 |
elif submitted and not topic:
|
28 |
st.error("Please enter a topic to generate a post.")
|