Spaces:
Runtime error
Runtime error
Commit
·
d43f0b6
1
Parent(s):
d72be0f
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,49 @@
|
|
1 |
import streamlit as st
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
def process_article_content(content):
|
4 |
-
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
# Streamlit app
|
9 |
def main():
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
+
|
4 |
+
def get_diabetic_heading(data):
|
5 |
+
|
6 |
+
llm = OpenAI(temperature=0,openai_api_key=api_key)
|
7 |
+
|
8 |
+
prompt_template = """this is article content and my user is diabetic health now give me user specific or we can
|
9 |
+
personalize heading hook line for article and need only article heading nothing else
|
10 |
+
|
11 |
+
article content: {text} """
|
12 |
+
PROMPT = PromptTemplate(
|
13 |
+
template=prompt_template, input_variables=["text"]
|
14 |
+
)
|
15 |
+
chain = LLMChain(llm=llm, prompt=PROMPT)
|
16 |
+
resp = chain.run(text=data)
|
17 |
+
|
18 |
+
return resp
|
19 |
+
|
20 |
+
|
21 |
+
def get_diabetic_heading(data):
|
22 |
+
|
23 |
+
llm = OpenAI(temperature=0,openai_api_key=api_key)
|
24 |
+
|
25 |
+
prompt_template = """this is article content and my user is cancer health now give me user specific or we can
|
26 |
+
personalize heading hook line for article and need only article heading nothing else
|
27 |
+
|
28 |
+
article content: {text} """
|
29 |
+
PROMPT = PromptTemplate(
|
30 |
+
template=prompt_template, input_variables=["text"]
|
31 |
+
)
|
32 |
+
chain = LLMChain(llm=llm, prompt=PROMPT)
|
33 |
+
resp = chain.run(text=data)
|
34 |
+
|
35 |
+
return resp
|
36 |
+
|
37 |
+
|
38 |
def process_article_content(content):
|
39 |
+
heading_1 = get_diabetic_heading(content)
|
40 |
+
heading_2 = get_cancer_heading(content)
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
+
# words = len(content.split())
|
45 |
+
# characters = len(content)
|
46 |
+
return heading_1, heading_2
|
47 |
|
48 |
# Streamlit app
|
49 |
def main():
|