Spaces:
Runtime error
Runtime error
Commit
·
c8739b3
1
Parent(s):
653e3d0
Update app.py
Browse files
app.py
CHANGED
@@ -8,11 +8,11 @@ from langchain.chains import LLMChain
|
|
8 |
|
9 |
api_key = os.environ['openai_api_key']
|
10 |
|
11 |
-
def
|
12 |
|
13 |
llm = OpenAI(temperature=0,openai_api_key=api_key)
|
14 |
|
15 |
-
prompt_template = """this is article content and my user is
|
16 |
personalize heading hook line for article and need only article heading nothing else
|
17 |
|
18 |
article content: {text} """
|
@@ -25,11 +25,11 @@ def get_diabetic_heading(data):
|
|
25 |
return resp
|
26 |
|
27 |
|
28 |
-
def
|
29 |
|
30 |
llm = OpenAI(temperature=0,openai_api_key=api_key)
|
31 |
|
32 |
-
prompt_template = """this is article content and my user is
|
33 |
personalize heading hook line for article and need only article heading nothing else
|
34 |
|
35 |
article content: {text} """
|
@@ -44,7 +44,7 @@ def get_cancer_heading(data):
|
|
44 |
|
45 |
def process_article_content(content):
|
46 |
|
47 |
-
return
|
48 |
|
49 |
# Streamlit app
|
50 |
def main():
|
@@ -57,12 +57,12 @@ def main():
|
|
57 |
if st.button("Process"):
|
58 |
# Process the article content
|
59 |
if article_content:
|
60 |
-
|
61 |
|
62 |
# Display the output
|
63 |
st.subheader("Processed Output:")
|
64 |
-
st.write(f"{
|
65 |
-
st.write(f"{
|
66 |
|
67 |
if __name__ == "__main__":
|
68 |
main()
|
|
|
8 |
|
9 |
api_key = os.environ['openai_api_key']
|
10 |
|
11 |
+
def get_insurance_heading(data):
|
12 |
|
13 |
llm = OpenAI(temperature=0,openai_api_key=api_key)
|
14 |
|
15 |
+
prompt_template = """this is article content and my user is insurance now give me user specific or we can
|
16 |
personalize heading hook line for article and need only article heading nothing else
|
17 |
|
18 |
article content: {text} """
|
|
|
25 |
return resp
|
26 |
|
27 |
|
28 |
+
def get_sports_heading(data):
|
29 |
|
30 |
llm = OpenAI(temperature=0,openai_api_key=api_key)
|
31 |
|
32 |
+
prompt_template = """this is article content and my user is sports now give me user specific or we can
|
33 |
personalize heading hook line for article and need only article heading nothing else
|
34 |
|
35 |
article content: {text} """
|
|
|
44 |
|
45 |
def process_article_content(content):
|
46 |
|
47 |
+
return get_insurance_heading(content), get_sports_heading(content)
|
48 |
|
49 |
# Streamlit app
|
50 |
def main():
|
|
|
57 |
if st.button("Process"):
|
58 |
# Process the article content
|
59 |
if article_content:
|
60 |
+
insurance_user, sports_user = process_article_content(article_content)
|
61 |
|
62 |
# Display the output
|
63 |
st.subheader("Processed Output:")
|
64 |
+
st.write(f"{insurance_user}")
|
65 |
+
st.write(f"{sports_user}")
|
66 |
|
67 |
if __name__ == "__main__":
|
68 |
main()
|