AnanthulaShravya commited on
Commit
9ec25ff
·
verified ·
1 Parent(s): 5edae20

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +49 -24
app.py CHANGED
@@ -1,22 +1,45 @@
1
-
2
  import streamlit as st
3
- import requests
4
-
5
- # st.title('Number Doubler')
6
-
7
-
8
- # user_input = st.number_input('Enter a number')
9
 
10
- # def double_number(number):
11
- # url = 'http://localhost:8000/double_number'
12
- # data = {"number": number}
13
- # response = requests.post(url, json=data)
14
- # return response.json()
15
 
16
  def kickoff(inputs={}):
17
- return inputs
18
-
19
- til_content = st.text_area('Enter what you learnt today:',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  "* Quantization is the process of reducing the size of LLM models by reducing the underlying weights.\n"
21
  "* 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"
22
  "* Quantization offers benefits such as reduced storage space usage and faster computation.\n"
@@ -24,14 +47,16 @@ til_content = st.text_area('Enter what you learnt today:',
24
  "* I learnt how to use Go Routines to handle concurrency in React.\n",
25
  key='til_content', help='Enter what you learnt today')
26
 
27
- if st.button("Get Feedback"):
28
- inputs = {"content": til_content}
29
- results = kickoff(inputs=inputs)
 
 
 
 
30
 
31
- # if st.button('Double'):
32
- # if user_input:
33
- # result = double_number(user_input)
34
- # st.write('Doubled Number:', result['doubled_number'])
35
- # else:
36
- # st.warning('Please enter a number')
37
 
 
 
 
 
1
  import streamlit as st
2
+ from dotenv import load_dotenv
 
 
 
 
 
3
 
4
+ load_dotenv()
 
 
 
 
5
 
6
  def kickoff(inputs={}):
7
+ # Simulate feedback processing
8
+ return {"feedback": [{"til": inputs["content"], "feedback": "ok"}]}
9
+
10
+ def main():
11
+ st.markdown("<div class='container'>", unsafe_allow_html=True)
12
+
13
+ st.markdown(
14
+ """
15
+ <div class="centered">
16
+ <p class="title">Today I Learnt Feedback</p>
17
+ <p class="description">Feedback on Today I Learnt</p>
18
+ </div>
19
+ """,
20
+ unsafe_allow_html=True
21
+ )
22
+
23
+ # default_content = (
24
+ # "* Quantization is the process of reducing the size of LLM models by reducing the underlying weights.\n"
25
+ # "* 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"
26
+ # "* Quantization offers benefits such as reduced storage space usage and faster computation.\n"
27
+ # "* Disadvantages: Answers are less precise\n"
28
+ # "* I learnt how to use Go Routines to handle concurrency in React.\n"
29
+ # )
30
+
31
+ # # Initialize session state for the text area content if not already set
32
+ # if 'til_content' not in st.session_state:
33
+ # st.session_state.til_content = default_content
34
+
35
+ # til_content = st.text_area(
36
+ # 'Enter what you learnt today:',
37
+ # value=st.session_state.til_content,
38
+ # key='til_content',
39
+ # help='Enter what you learnt today'
40
+ # )
41
+
42
+ til_content = st.text_area('Enter what you learnt today:',
43
  "* Quantization is the process of reducing the size of LLM models by reducing the underlying weights.\n"
44
  "* 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"
45
  "* Quantization offers benefits such as reduced storage space usage and faster computation.\n"
 
47
  "* I learnt how to use Go Routines to handle concurrency in React.\n",
48
  key='til_content', help='Enter what you learnt today')
49
 
50
+ if st.button("Get Feedback"):
51
+ inputs = {"content": til_content}
52
+ results = kickoff(inputs=inputs)
53
+
54
+ for result in results["feedback"]:
55
+ st.markdown(f"#### TIL: {result['til']}")
56
+ st.markdown(f"**Feedback:** {result['feedback']}")
57
 
58
+ # Update the session state with the new input content
59
+ st.session_state.til_content = til_content
 
 
 
 
60
 
61
+ if __name__ == "__main__":
62
+ main()