Spaces:
Runtime error
Runtime error
| from crew.til import TilCrew | |
| import streamlit as st | |
| from streamlit_extras.capture import stdout | |
| # crew = TilCrew() | |
| # results = crew.kickoff(inputs={"content": "Today I learnt Sidecar pattern"}) | |
| # results = crew.kickoff(inputs={"content": "Learnt about go-lang routines to add concurrency in the React App."}) | |
| # 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."}) | |
| # print(results) | |
| def main(): | |
| st.set_page_config(page_title='Today I Learnt', | |
| page_icon='📰', layout='wide') | |
| st.markdown("<div class='container'>", unsafe_allow_html=True) | |
| st.markdown( | |
| """ | |
| <div class="centered"> | |
| <p class="title">Today I Learnt Feedback</p> | |
| <p class="description">Feedback on Today I Learnt</p> | |
| </div> | |
| """, | |
| unsafe_allow_html=True | |
| ) | |
| til_content = st.text_area('Enter what you learnt today:', | |
| "My notes on Synthetic data:\n" | |
| "What: Synthetic data is information that is not generated by real-world occurrences but is artificially generated. " | |
| "Why is it needed? Product Testing, Training ML Algos, Reduced constraints when using reglated data." | |
| "Types: Fully Synthetic data, Partially Synthetic data" | |
| "Varities: Text, Tabular, Media." | |
| "Benchmarks to consider: Accuracy, Privacy." | |
| "Notes from https://www.turing.com/kb/synthetic-data-generation-techniques." | |
| "Techniques: Statistical distribution, Agent to model, Using Deep Learning/Generative AI, Synthetic Minority Oversampling Technique.", | |
| key='til_content', help='Enter what you learnt today', height=300) | |
| if st.button("Get Feedback"): | |
| with st.status( | |
| "🤖 **Analysing TIL...**", state="running", expanded=True | |
| ) as status: | |
| with st.container(height=500, border=False): | |
| log_container = st.empty() | |
| with stdout(log_container.code, terminator=""): | |
| feedback = TilCrew() | |
| inputs = {"notes": til_content} | |
| results = feedback.kickoff(inputs=inputs) | |
| status.update( | |
| label="✅ Feedback ready!", | |
| state="complete", | |
| expanded=False, | |
| ) | |
| for result in results: | |
| # st.markdown(result) | |
| st.markdown(f"#### TIL: {result['til']}") | |
| st.markdown(f"**Feedback:** {result['feedback']}") | |
| if result['feedback'] == "not_ok": | |
| st.markdown(f"**Criteria:** {result['feedback_criteria']}") | |
| st.markdown(f"**Reason:** {result['reason']}") | |
| if result.get('suggestion') is not None: | |
| st.markdown(f"**Suggestion:** {result['suggestion']}") | |
| if __name__ == "__main__": | |
| main() | |