Spaces:
Runtime error
Runtime error
| import streamlit as st | |
| from dotenv import load_dotenv | |
| from crew.til import TilCrew | |
| from streamlit_extras.capture import stdout | |
| load_dotenv() | |
| def main(): | |
| 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:', | |
| "I went through the following course on quantization of LLM: https://www.deeplearning.ai/short-courses/quantization-in-depth/ and here are my insights: \n" | |
| "* Quantization is the process of reducing the size of LLM models by reducing the underlying weights.\n" | |
| "* The weights are reduced by scaling down the datatypes from a datatype that takes larger space to a data type that takes a smaller space, this is also known as downcasting.\n" | |
| "* Advantages: takes lesser space and increases compute speed\n" | |
| "* Disadvantages: Answers are less precise\n\n" | |
| "My notes on Synthetic data:\n" | |
| "* Why is it needed? Product Testing, Training ML Algos, Reduced constraints when using reglated data.\n" | |
| "* Types: Fully Synthetic data, Partially Synthetic data\n" | |
| "* Varities: Text, Tabular, Media.\n" | |
| "* Benchmarks to consider: Accuracy, Privacy\n" | |
| "* Techniques: Statistical distribution, Agent to model, Using Deep Learning/Generative AI, Synthetic Minority Oversampling Technique.", | |
| key='til_content', help='Enter what you learnt today') | |
| 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 = {"content": til_content} | |
| results = feedback.kickoff(inputs=inputs)["feedback"] | |
| status.update( | |
| label="✅ Feedback ready!", | |
| state="complete", | |
| expanded=False, | |
| ) | |
| for result in results: | |
| 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() | |