Spaces:
Runtime error
Runtime error
Merge pull request #4 from beautiful-code/feature/add-streamlit-ui
Browse files- agents/learning_profiler.py +0 -1
- app.py +1 -3
- tasks/create_article_pitch.py +2 -2
- tasks/create_learning_profile.py +6 -1
- tasks/evaluate_articles.py +6 -6
- tasks/new_article_suggestion.py +0 -1
agents/learning_profiler.py
CHANGED
|
@@ -12,7 +12,6 @@ learning_profiler = Agent(
|
|
| 12 |
"The profile you build gives a high level overview of what interests that the user has. "
|
| 13 |
),
|
| 14 |
allow_delegation=False,
|
| 15 |
-
OPENAI_API_KEY="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",
|
| 16 |
llm=llm,
|
| 17 |
step_callback=streamlit_callback
|
| 18 |
)
|
|
|
|
| 12 |
"The profile you build gives a high level overview of what interests that the user has. "
|
| 13 |
),
|
| 14 |
allow_delegation=False,
|
|
|
|
| 15 |
llm=llm,
|
| 16 |
step_callback=streamlit_callback
|
| 17 |
)
|
app.py
CHANGED
|
@@ -9,9 +9,7 @@ from utils.write_to_json import write_dict_to_json as write_dict_to_json
|
|
| 9 |
|
| 10 |
settings.init()
|
| 11 |
|
| 12 |
-
load_dotenv(
|
| 13 |
-
"/home/quizra/Documents/Learning_practise/python/streamlit/growthi-app/growthy_agents/.env"
|
| 14 |
-
)
|
| 15 |
|
| 16 |
|
| 17 |
def icon(emoji: str):
|
|
|
|
| 9 |
|
| 10 |
settings.init()
|
| 11 |
|
| 12 |
+
load_dotenv()
|
|
|
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
def icon(emoji: str):
|
tasks/create_article_pitch.py
CHANGED
|
@@ -23,8 +23,8 @@ class PitchedArticles(BaseModel):
|
|
| 23 |
|
| 24 |
|
| 25 |
def callback_function(output: TaskOutput):
|
| 26 |
-
|
| 27 |
-
|
| 28 |
# for article in evaluated_articles:
|
| 29 |
# settings.articles[article['url']]['pitch'] = article['pitch']
|
| 30 |
st.markdown("### Create Article Pitch is executed successfully!")
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
def callback_function(output: TaskOutput):
|
| 26 |
+
evaluated_articles = json.loads(output.exported_output)['articles']
|
| 27 |
+
st.markdown(evaluated_articles)
|
| 28 |
# for article in evaluated_articles:
|
| 29 |
# settings.articles[article['url']]['pitch'] = article['pitch']
|
| 30 |
st.markdown("### Create Article Pitch is executed successfully!")
|
tasks/create_learning_profile.py
CHANGED
|
@@ -19,7 +19,12 @@ class LearningProfile(BaseModel):
|
|
| 19 |
learnings: List[Topic]
|
| 20 |
|
| 21 |
def callback_function(output: TaskOutput):
|
| 22 |
-
st.markdown("###
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
learning_profile_task = Task(
|
| 25 |
description=(
|
|
|
|
| 19 |
learnings: List[Topic]
|
| 20 |
|
| 21 |
def callback_function(output: TaskOutput):
|
| 22 |
+
st.markdown("### Learning profile of the user:")
|
| 23 |
+
data=json.loads(output.exported_output)
|
| 24 |
+
st.markdown(f"**topics_of_interests:** {data['topics_of_interests'][0]}")
|
| 25 |
+
st.markdown(f"**learnings:**")
|
| 26 |
+
for topic in data['learnings']:
|
| 27 |
+
st.markdown(f"*{topic['name']}*:{topic['insights'][0]}")
|
| 28 |
|
| 29 |
learning_profile_task = Task(
|
| 30 |
description=(
|
tasks/evaluate_articles.py
CHANGED
|
@@ -23,13 +23,13 @@ class EvaluatedArticles(BaseModel):
|
|
| 23 |
|
| 24 |
|
| 25 |
def callback_function(output: TaskOutput):
|
| 26 |
-
|
| 27 |
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
st.markdown("### Evaluate Articles task is executed successfully!")
|
| 34 |
|
| 35 |
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
def callback_function(output: TaskOutput):
|
| 26 |
+
evaluated_articles = json.loads(output.exported_output)['articles']
|
| 27 |
|
| 28 |
+
for article in evaluated_articles:
|
| 29 |
+
settings.articles[article['url']
|
| 30 |
+
]['evaluation_score'] = article['evaluation_score']
|
| 31 |
+
settings.articles[article['url']
|
| 32 |
+
]['evaluation_reason'] = article['evaluation_reason']
|
| 33 |
st.markdown("### Evaluate Articles task is executed successfully!")
|
| 34 |
|
| 35 |
|
tasks/new_article_suggestion.py
CHANGED
|
@@ -23,7 +23,6 @@ class SuggestedArticles(BaseModel):
|
|
| 23 |
|
| 24 |
def callback_function(output: TaskOutput):
|
| 25 |
suggested_articles = json.loads(output.exported_output)['articles']
|
| 26 |
-
|
| 27 |
for article in suggested_articles:
|
| 28 |
settings.articles[article['url']] = article
|
| 29 |
st.markdown("### New Article Suggestion task is executed successfully!")
|
|
|
|
| 23 |
|
| 24 |
def callback_function(output: TaskOutput):
|
| 25 |
suggested_articles = json.loads(output.exported_output)['articles']
|
|
|
|
| 26 |
for article in suggested_articles:
|
| 27 |
settings.articles[article['url']] = article
|
| 28 |
st.markdown("### New Article Suggestion task is executed successfully!")
|