Praveen998 commited on
Commit
c6c1795
·
1 Parent(s): 58d3709

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +78 -50
app.py CHANGED
@@ -26,59 +26,87 @@ def on_btn_click():
26
 
27
 
28
  def main():
29
- st.title(" Stock Forecasting App")
30
- uploaded_file = st.file_uploader("Choose a file", type=["jpg", "png", "mp3"])
31
- value = st.slider(
32
- " Select Horizon Period", min_value=0, max_value=100, value=50, key=69
 
 
33
  )
34
- value = st.slider(" Folds", min_value=0, max_value=100, value=50, key=17)
35
- if st.button(" start"):
36
- st.write("Button clicked!")
37
- st.title(" Training")
38
- (
39
- col1,
40
- col2,
41
- ) = st.columns(2)
42
- with col1:
43
- st.table(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  {
45
- "Country": ["USA", "Canada", "UK", "Australia"],
46
- "Population (millions)": [331, 38, 66, 25],
47
- "GDP (trillion USD)": [22.675, 1.843, 2.855, 1.488],
48
- }
49
- )
50
- with col2:
51
- data = {"key": "value", "name": "John Doe", "age": 30}
52
- st.json(data)
53
- st.title(" Forecast")
54
- (
55
- col1,
56
- col2,
57
- ) = st.columns(2)
58
- with col1:
59
- st.line_chart(
60
- pd.DataFrame(
61
- {
62
- "Apple": yf.download("AAPL", start="2023-01-01", end="2023-07-31")[
63
- "Adj Close"
64
- ],
65
- "Google": yf.download(
66
- "GOOGL", start="2023-01-01", end="2023-07-31"
67
- )["Adj Close"],
68
- "Microsoft": yf.download(
69
- "MSFT", start="2023-01-01", end="2023-07-31"
70
- )["Adj Close"],
71
- }
72
- )
73
- )
74
- with col2:
75
- data = pd.DataFrame(
76
- {"X": [1, 2, 3, 4, 5], "Y1": [10, 16, 8, 14, 12], "Y2": [5, 8, 3, 6, 7]}
77
- )
78
- st.area_chart(data)
79
- st.bar_chart(
80
- pd.DataFrame(np.random.randn(20, 3), columns=["Apple", "Banana", "Cherry"])
81
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
 
84
  if __name__ == "__main__":
 
26
 
27
 
28
  def main():
29
+ st.title(" Simple LLM Chat Box")
30
+ from streamlit_chat import message
31
+ from streamlit.components.v1 import html
32
+
33
+ audio_path = (
34
+ "https://docs.google.com/uc?export=open&id=16QSvoLWNxeqco_Wb2JvzaReSAw5ow6Cl"
35
  )
36
+ img_path = "https://www.groundzeroweb.com/wp-content/uploads/2017/05/Funny-Cat-Memes-11.jpg"
37
+ markdown = """### HTML in markdown is ~quite~ **unsafe**
38
+ <blockquote>However, if you are in a trusted environment (you trust the markdown). You can use allow_html props to enable support for html.</blockquote>
39
+ * Lists
40
+ * [ ] todo
41
+ * [x] done
42
+
43
+ Math:
44
+
45
+ Lift($L$) can be determined by Lift Coefficient ($C_L$) like the following
46
+ equation.
47
+
48
+ $$
49
+ L = \\frac{1}{2} \\rho v^2 S C_L
50
+ $$
51
+
52
+ ~~~py
53
+ import streamlit as st
54
+
55
+ st.write("Python code block")
56
+ ~~~
57
+
58
+ ~~~js
59
+ console.log("Here is some JavaScript code")
60
+ ~~~
61
+ """
62
+ table_markdown = """A Table:
63
+ | Feature | Support |
64
+ | ----------: | :------------------- |
65
+ | CommonMark | 100% |
66
+ | GFM | 100% w/ `remark-gfm` |
67
+ """
68
+ youtube_embed = """<iframe width="400" height="215" src="https://www.youtube.com/embed/LMQ5Gauy17k" title="YouTube video player" frameborder="0" allow="accelerometer; encrypted-media;"></iframe>"""
69
+ st.session_state.setdefault(
70
+ "past",
71
+ [
72
+ "plan text with line break",
73
+ 'play the song "Dancing Vegetables"',
74
+ "show me image of cat",
75
+ "and video of it",
76
+ "show me some markdown sample",
77
+ "table in markdown",
78
+ ],
79
+ )
80
+ st.session_state.setdefault(
81
+ "generated",
82
+ [
83
+ {"type": "normal", "data": "Line 1 \n Line 2 \n Line 3"},
84
+ {"type": "normal", "data": f'<audio controls src="{audio_path}"></audio>'},
85
  {
86
+ "type": "normal",
87
+ "data": f'<img width="100%" height="200" src="{img_path}"/>',
88
+ },
89
+ {"type": "normal", "data": f"{youtube_embed}"},
90
+ {"type": "normal", "data": f"{markdown}"},
91
+ {"type": "table", "data": f"{table_markdown}"},
92
+ ],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  )
94
+ st.title("Chat placeholder")
95
+ chat_placeholder = st.empty()
96
+ with chat_placeholder.container():
97
+ for i in range(len(st.session_state["generated"])):
98
+ message(st.session_state["past"][i], is_user=True, key=f"{i}_user")
99
+ message(
100
+ st.session_state["generated"][i]["data"],
101
+ key=f"{i}",
102
+ allow_html=True,
103
+ is_table=True
104
+ if st.session_state["generated"][i]["type"] == "table"
105
+ else False,
106
+ )
107
+ st.button("Clear message", on_click=on_btn_click)
108
+ with st.container():
109
+ st.text_input("User Input:", on_change=on_input_change, key="user_input")
110
 
111
 
112
  if __name__ == "__main__":