Spaces:
Runtime error
Runtime error
added support for til learnt analysis
Browse files- crew/til.py +101 -0
- research_paper.py +130 -0
- test.py +22 -103
crew/til.py
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from langchain_core.prompts import ChatPromptTemplate, HumanMessagePromptTemplate
|
| 2 |
+
from langchain_core.messages import SystemMessage
|
| 3 |
+
from pydantic import BaseModel, Field
|
| 4 |
+
from langchain_core.output_parsers import JsonOutputParser
|
| 5 |
+
from langchain_openai import ChatOpenAI
|
| 6 |
+
|
| 7 |
+
HIGH_IMPACT_THRESHOLD = 8
|
| 8 |
+
LOW_IMPACT_THRESHOLD = 7
|
| 9 |
+
OPENAI_MODEL = "gpt-4o"
|
| 10 |
+
|
| 11 |
+
class TilCrew:
|
| 12 |
+
def kickoff(self, inputs={}):
|
| 13 |
+
self.content = inputs["content"]
|
| 14 |
+
self._gather_feedback()
|
| 15 |
+
return self._final_call_on_feedback()
|
| 16 |
+
|
| 17 |
+
def _final_call_on_feedback(self):
|
| 18 |
+
if self.feedback["factuality_score"] < HIGH_IMPACT_THRESHOLD:
|
| 19 |
+
return {
|
| 20 |
+
"feedback": "not_ok",
|
| 21 |
+
"feedback_criteria": "factuality_feedback",
|
| 22 |
+
"reason": self.feedback["factuality_reason"],
|
| 23 |
+
"suggestion": self.feedback["final_suggestion"],
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
if self.feedback["insightful_score"] < HIGH_IMPACT_THRESHOLD:
|
| 27 |
+
return {
|
| 28 |
+
"feedback": "not_ok",
|
| 29 |
+
"feedback_criteria": "insightful_feedback",
|
| 30 |
+
"reason": self.feedback["insightful_reason"],
|
| 31 |
+
"suggestion": self.feedback["final_suggestion"],
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
if self.feedback["simplicity_score"] < LOW_IMPACT_THRESHOLD:
|
| 35 |
+
return {
|
| 36 |
+
"feedback": "not_ok",
|
| 37 |
+
"feedback_criteria": "simplicity_feedback",
|
| 38 |
+
"reason": self.feedback["simplicity_reason"],
|
| 39 |
+
"suggestion": self.feedback["final_suggestion"],
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
if self.feedback["grammatical_score"] < LOW_IMPACT_THRESHOLD:
|
| 43 |
+
return {
|
| 44 |
+
"feedback": "not_ok",
|
| 45 |
+
"feedback_criteria": "grammatical_feedback",
|
| 46 |
+
"reason": self.feedback["grammatical_reason"],
|
| 47 |
+
"suggestion": self.feedback["final_suggestion"],
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
return {
|
| 51 |
+
"feedback": "ok",
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
def _gather_feedback(self):
|
| 55 |
+
feedback_chain = self._build_feedback_chain()
|
| 56 |
+
print("Analysing the TIL.....")
|
| 57 |
+
self.feedback = feedback_chain.invoke({"til_content": self.content})
|
| 58 |
+
print("Feedback: ", self.feedback)
|
| 59 |
+
|
| 60 |
+
def _build_feedback_chain(self):
|
| 61 |
+
feedback_parser = JsonOutputParser(pydantic_object=TilFeedbackResult)
|
| 62 |
+
feedback_prompt = ChatPromptTemplate.from_messages([
|
| 63 |
+
SystemMessage(
|
| 64 |
+
"You are a 'Personal TIL Reviewer' who works in an Product Engineering Services company, you responsibility is to guide the user to write better TILs. "
|
| 65 |
+
"Your personal goal is to review a user's TIL and suggested edits based on the following criteria:\n"
|
| 66 |
+
"1. Is the TIL insightful?"
|
| 67 |
+
"2. Is the TIL factually correct?"
|
| 68 |
+
"3. Is the TIL written in simple english?"
|
| 69 |
+
"4. Is the TIL grammatically correct?"
|
| 70 |
+
|
| 71 |
+
"Can you provide a score for on the scale of 10 for each of these criteria and provide reasons for the score, the reason should be presented in the POV of the Personal TIL Reviewer."
|
| 72 |
+
f"Formatting Instructions: {feedback_parser.get_format_instructions()}"
|
| 73 |
+
),
|
| 74 |
+
HumanMessagePromptTemplate.from_template("{til_content}")
|
| 75 |
+
])
|
| 76 |
+
print("Prompt: ", feedback_prompt)
|
| 77 |
+
llm = ChatOpenAI(model=OPENAI_MODEL, temperature=0.2)
|
| 78 |
+
analysis_chain = feedback_prompt | llm | feedback_parser
|
| 79 |
+
|
| 80 |
+
return analysis_chain
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
class TilFeedbackResult(BaseModel):
|
| 84 |
+
insightful_score: int = Field(
|
| 85 |
+
description="TIL score on insightful criteria")
|
| 86 |
+
insightful_reason: str = Field(description="Reason for insightful_score")
|
| 87 |
+
# insightful_pass: bool = Field(description="True if it passes the insightful criteria, else Fales")
|
| 88 |
+
factuality_score: int = Field(
|
| 89 |
+
description="TIL score on factuality criteria")
|
| 90 |
+
factuality_reason: str = Field(description="Reason for factuality_score")
|
| 91 |
+
# factuality_pass: bool = Field(description="True if it passes the factuality criteria, else Fales")
|
| 92 |
+
simplicity_score: int = Field(
|
| 93 |
+
description="TIL score on simplicity criteria")
|
| 94 |
+
simplicity_reason: str = Field(description="Reason for simplicity_score")
|
| 95 |
+
# simplicity_pass: bool = Field(description="True if it passes the simplicity criteria, else Fales")
|
| 96 |
+
grammatical_score: int = Field(
|
| 97 |
+
description="TIL score on grammatical criteria")
|
| 98 |
+
grammatical_reason: str = Field(description="Reason for grammatical_score")
|
| 99 |
+
# grammatical_pass: bool = Field(description="True if it passes the grammatical criteria, else Fales")
|
| 100 |
+
final_suggestion: str = Field(
|
| 101 |
+
description="Final suggested version of the TIL")
|
research_paper.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from crew.research_article_suggester import RecentArticleSuggester
|
| 3 |
+
from streamlit_extras.capture import stdout
|
| 4 |
+
|
| 5 |
+
def main():
|
| 6 |
+
st.set_page_config(page_title='Recent Article Suggester', page_icon='📰', layout='wide')
|
| 7 |
+
|
| 8 |
+
st.markdown(
|
| 9 |
+
"""
|
| 10 |
+
<style>
|
| 11 |
+
.main {
|
| 12 |
+
background-color: #f5f5f5;
|
| 13 |
+
padding: 20px;
|
| 14 |
+
border-radius: 10px;
|
| 15 |
+
}
|
| 16 |
+
.centered {
|
| 17 |
+
display: flex;
|
| 18 |
+
flex-direction: column;
|
| 19 |
+
align-items: center;
|
| 20 |
+
justify-content: center;
|
| 21 |
+
text-align: center;
|
| 22 |
+
}
|
| 23 |
+
.title {
|
| 24 |
+
font-family: 'Helvetica', sans-serif;
|
| 25 |
+
font-weight: bold;
|
| 26 |
+
font-size: 36px;
|
| 27 |
+
color: #1f77b4;
|
| 28 |
+
}
|
| 29 |
+
.description {
|
| 30 |
+
font-family: 'Helvetica', sans-serif;
|
| 31 |
+
font-size: 18px;
|
| 32 |
+
color: #333333;
|
| 33 |
+
margin-top: 10px;
|
| 34 |
+
}
|
| 35 |
+
.subheader {
|
| 36 |
+
font-family: 'Helvetica', sans-serif;
|
| 37 |
+
font-weight: bold;
|
| 38 |
+
font-size: 24px;
|
| 39 |
+
color: #ff7f0e;
|
| 40 |
+
margin-top: 20px;
|
| 41 |
+
}
|
| 42 |
+
.element {
|
| 43 |
+
background-color: #ffffff;
|
| 44 |
+
padding: 1rem;
|
| 45 |
+
border-radius: 8px;
|
| 46 |
+
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
| 47 |
+
margin-bottom: 1rem;
|
| 48 |
+
}
|
| 49 |
+
.element h3 {
|
| 50 |
+
font-size: 24px;
|
| 51 |
+
color: #1f77b4;
|
| 52 |
+
margin-bottom: 0.5rem;
|
| 53 |
+
text-transform: uppercase;
|
| 54 |
+
padding :10px;
|
| 55 |
+
|
| 56 |
+
}
|
| 57 |
+
.element ul {
|
| 58 |
+
list-style-type: none;
|
| 59 |
+
padding: 0;
|
| 60 |
+
margin: 0;
|
| 61 |
+
}
|
| 62 |
+
.element li {
|
| 63 |
+
font-size: 16px;
|
| 64 |
+
color: #333333;
|
| 65 |
+
margin-bottom: 0.5rem;
|
| 66 |
+
}
|
| 67 |
+
.element li b {
|
| 68 |
+
font-size: 22px;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
</style>
|
| 72 |
+
""",
|
| 73 |
+
unsafe_allow_html=True
|
| 74 |
+
)
|
| 75 |
+
|
| 76 |
+
st.markdown("<div class='container'>", unsafe_allow_html=True)
|
| 77 |
+
|
| 78 |
+
st.markdown(
|
| 79 |
+
"""
|
| 80 |
+
<div class="centered">
|
| 81 |
+
<p class="title">Recent Article Suggester</p>
|
| 82 |
+
<p class="description">Discover recent articles based on your topic of interest using advanced AI.</p>
|
| 83 |
+
</div>
|
| 84 |
+
""",
|
| 85 |
+
unsafe_allow_html=True
|
| 86 |
+
)
|
| 87 |
+
|
| 88 |
+
st.sidebar.markdown("<p class='sidebar-header'>Search for the papers you are interested in:</p>", unsafe_allow_html=True)
|
| 89 |
+
topic = st.sidebar.text_input('Enter a topic:', 'GenAI', key='topic_input', help='Enter a topic of interest')
|
| 90 |
+
|
| 91 |
+
if st.sidebar.button('Get Suggestions'):
|
| 92 |
+
|
| 93 |
+
with st.status(
|
| 94 |
+
"🤖 **Agents at work...**", state="running", expanded=True
|
| 95 |
+
) as status:
|
| 96 |
+
with st.container(height=500, border=False):
|
| 97 |
+
log_container = st.empty()
|
| 98 |
+
with stdout(log_container.code, terminator=""):
|
| 99 |
+
suggester = RecentArticleSuggester()
|
| 100 |
+
inputs = {"topic": topic}
|
| 101 |
+
results = suggester.kickoff(inputs=inputs)
|
| 102 |
+
status.update(
|
| 103 |
+
label="✅ Articles are Ready for Reading!",
|
| 104 |
+
state="complete",
|
| 105 |
+
expanded=False,
|
| 106 |
+
)
|
| 107 |
+
|
| 108 |
+
st.subheader("", anchor=False, divider="rainbow")
|
| 109 |
+
|
| 110 |
+
if results is None:
|
| 111 |
+
st.markdown('No articles found.', unsafe_allow_html=True)
|
| 112 |
+
else:
|
| 113 |
+
|
| 114 |
+
st.markdown('<p class="subheader">Results:</p>', unsafe_allow_html=True)
|
| 115 |
+
|
| 116 |
+
for element in results:
|
| 117 |
+
st.markdown(
|
| 118 |
+
f"""
|
| 119 |
+
<div class="element">
|
| 120 |
+
<h3><a href="{element['url']}" target="_blank">{element['title']}</a></h3>
|
| 121 |
+
<ul>
|
| 122 |
+
{"".join(f"<li style='font-size: 20px;'><b>{key.capitalize()}:</b> {value}</li>" for key, value in element.items() if key != "title")}
|
| 123 |
+
</ul>
|
| 124 |
+
</div>
|
| 125 |
+
""",
|
| 126 |
+
unsafe_allow_html=True
|
| 127 |
+
)
|
| 128 |
+
|
| 129 |
+
if __name__ == "__main__":
|
| 130 |
+
main()
|
test.py
CHANGED
|
@@ -1,130 +1,49 @@
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
-
from crew.research_article_suggester import RecentArticleSuggester
|
| 3 |
from streamlit_extras.capture import stdout
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
<style>
|
| 11 |
-
.main {
|
| 12 |
-
background-color: #f5f5f5;
|
| 13 |
-
padding: 20px;
|
| 14 |
-
border-radius: 10px;
|
| 15 |
-
}
|
| 16 |
-
.centered {
|
| 17 |
-
display: flex;
|
| 18 |
-
flex-direction: column;
|
| 19 |
-
align-items: center;
|
| 20 |
-
justify-content: center;
|
| 21 |
-
text-align: center;
|
| 22 |
-
}
|
| 23 |
-
.title {
|
| 24 |
-
font-family: 'Helvetica', sans-serif;
|
| 25 |
-
font-weight: bold;
|
| 26 |
-
font-size: 36px;
|
| 27 |
-
color: #1f77b4;
|
| 28 |
-
}
|
| 29 |
-
.description {
|
| 30 |
-
font-family: 'Helvetica', sans-serif;
|
| 31 |
-
font-size: 18px;
|
| 32 |
-
color: #333333;
|
| 33 |
-
margin-top: 10px;
|
| 34 |
-
}
|
| 35 |
-
.subheader {
|
| 36 |
-
font-family: 'Helvetica', sans-serif;
|
| 37 |
-
font-weight: bold;
|
| 38 |
-
font-size: 24px;
|
| 39 |
-
color: #ff7f0e;
|
| 40 |
-
margin-top: 20px;
|
| 41 |
-
}
|
| 42 |
-
.element {
|
| 43 |
-
background-color: #ffffff;
|
| 44 |
-
padding: 1rem;
|
| 45 |
-
border-radius: 8px;
|
| 46 |
-
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
| 47 |
-
margin-bottom: 1rem;
|
| 48 |
-
}
|
| 49 |
-
.element h3 {
|
| 50 |
-
font-size: 24px;
|
| 51 |
-
color: #1f77b4;
|
| 52 |
-
margin-bottom: 0.5rem;
|
| 53 |
-
text-transform: uppercase;
|
| 54 |
-
padding :10px;
|
| 55 |
-
|
| 56 |
-
}
|
| 57 |
-
.element ul {
|
| 58 |
-
list-style-type: none;
|
| 59 |
-
padding: 0;
|
| 60 |
-
margin: 0;
|
| 61 |
-
}
|
| 62 |
-
.element li {
|
| 63 |
-
font-size: 16px;
|
| 64 |
-
color: #333333;
|
| 65 |
-
margin-bottom: 0.5rem;
|
| 66 |
-
}
|
| 67 |
-
.element li b {
|
| 68 |
-
font-size: 22px;
|
| 69 |
-
}
|
| 70 |
-
|
| 71 |
-
</style>
|
| 72 |
-
""",
|
| 73 |
-
unsafe_allow_html=True
|
| 74 |
-
)
|
| 75 |
|
|
|
|
|
|
|
| 76 |
st.markdown("<div class='container'>", unsafe_allow_html=True)
|
| 77 |
|
| 78 |
st.markdown(
|
| 79 |
"""
|
| 80 |
<div class="centered">
|
| 81 |
-
<p class="title">
|
| 82 |
-
<p class="description">
|
| 83 |
</div>
|
| 84 |
""",
|
| 85 |
unsafe_allow_html=True
|
| 86 |
)
|
|
|
|
| 87 |
|
| 88 |
-
st.
|
| 89 |
-
topic = st.sidebar.text_input('Enter a topic:', 'GenAI', key='topic_input', help='Enter a topic of interest')
|
| 90 |
-
|
| 91 |
-
if st.sidebar.button('Get Suggestions'):
|
| 92 |
-
|
| 93 |
with st.status(
|
| 94 |
-
"🤖 **
|
| 95 |
) as status:
|
| 96 |
with st.container(height=500, border=False):
|
| 97 |
log_container = st.empty()
|
| 98 |
with stdout(log_container.code, terminator=""):
|
| 99 |
-
|
| 100 |
-
inputs = {"
|
| 101 |
-
|
| 102 |
status.update(
|
| 103 |
-
label="✅
|
| 104 |
state="complete",
|
| 105 |
expanded=False,
|
| 106 |
)
|
| 107 |
|
| 108 |
-
st.
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
st.markdown('<p class="subheader">Results:</p>', unsafe_allow_html=True)
|
| 115 |
-
|
| 116 |
-
for element in results:
|
| 117 |
-
st.markdown(
|
| 118 |
-
f"""
|
| 119 |
-
<div class="element">
|
| 120 |
-
<h3><a href="{element['url']}" target="_blank">{element['title']}</a></h3>
|
| 121 |
-
<ul>
|
| 122 |
-
{"".join(f"<li style='font-size: 20px;'><b>{key.capitalize()}:</b> {value}</li>" for key, value in element.items() if key != "title")}
|
| 123 |
-
</ul>
|
| 124 |
-
</div>
|
| 125 |
-
""",
|
| 126 |
-
unsafe_allow_html=True
|
| 127 |
-
)
|
| 128 |
|
| 129 |
if __name__ == "__main__":
|
| 130 |
main()
|
|
|
|
| 1 |
+
from crew.til import TilCrew
|
| 2 |
import streamlit as st
|
|
|
|
| 3 |
from streamlit_extras.capture import stdout
|
| 4 |
|
| 5 |
+
# crew = TilCrew()
|
| 6 |
+
# results = crew.kickoff(inputs={"content": "Today I learnt Sidecar pattern"})
|
| 7 |
+
# results = crew.kickoff(inputs={"content": "Learnt about go-lang routines to add concurrency in the React App."})
|
| 8 |
+
# results = crew.kickoff(inputs={"content": "Upon delving into the intricacies of Docker, I have acquired the capability to encapsulate our application within containers, thereby streamlining the deployment process across a multitude of heterogeneous environments."})
|
| 9 |
+
# print(results)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
def main():
|
| 12 |
+
st.set_page_config(page_title='Today I Learnt', page_icon='📰', layout='wide')
|
| 13 |
st.markdown("<div class='container'>", unsafe_allow_html=True)
|
| 14 |
|
| 15 |
st.markdown(
|
| 16 |
"""
|
| 17 |
<div class="centered">
|
| 18 |
+
<p class="title">Today I Learnt Feedback</p>
|
| 19 |
+
<p class="description">Feedback on Today I Learnt</p>
|
| 20 |
</div>
|
| 21 |
""",
|
| 22 |
unsafe_allow_html=True
|
| 23 |
)
|
| 24 |
+
til_content = st.text_input('Enter what you learnt today:', 'Upon delving into the intricacies of Docker, I have acquired the capability to encapsulate our application within containers, thereby streamlining the deployment process across a multitude of heterogeneous environments.', key='til_content', help='Enter what you learnt today')
|
| 25 |
|
| 26 |
+
if st.button("Get Feedback"):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
with st.status(
|
| 28 |
+
"🤖 **Analysing TIL...**", state="running", expanded=True
|
| 29 |
) as status:
|
| 30 |
with st.container(height=500, border=False):
|
| 31 |
log_container = st.empty()
|
| 32 |
with stdout(log_container.code, terminator=""):
|
| 33 |
+
feedback = TilCrew()
|
| 34 |
+
inputs = {"content": til_content}
|
| 35 |
+
result = feedback.kickoff(inputs=inputs)
|
| 36 |
status.update(
|
| 37 |
+
label="✅ Feedback ready!",
|
| 38 |
state="complete",
|
| 39 |
expanded=False,
|
| 40 |
)
|
| 41 |
|
| 42 |
+
st.markdown(f"# Feedback: {result['feedback']}")
|
| 43 |
+
if result['feedback'] == "not_ok":
|
| 44 |
+
st.markdown(f"**Criteria:** {result['feedback_criteria']}")
|
| 45 |
+
st.markdown(f"**Reason:** {result['reason']}")
|
| 46 |
+
st.markdown(f"**Suggestion:** {result['suggestion']}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
if __name__ == "__main__":
|
| 49 |
main()
|