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

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +69 -77
app.py CHANGED
@@ -26,87 +26,79 @@ def on_btn_click():
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__":
 
26
 
27
 
28
  def main():
29
+ st.title(" 3D Visualisation")
30
+ z_data = pd.read_csv(
31
+ "https://raw.githubusercontent.com/plotly/datasets/master/api_docs/mt_bruno_elevation.csv"
 
 
 
32
  )
33
+ fig = go.Figure(data=go.Surface(z=z_data, showscale=False))
34
+ fig.update_layout(
35
+ title="Mt Bruno Elevation",
36
+ width=400,
37
+ height=400,
38
+ margin=dict(t=40, r=0, l=20, b=20),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  )
40
+ name = "default"
41
+ camera = dict(
42
+ up=dict(x=0, y=0, z=1),
43
+ center=dict(x=0, y=0, z=0),
44
+ eye=dict(x=1.25, y=1.25, z=1.25),
45
+ )
46
+ fig.update_layout(scene_camera=camera, title=name)
47
+ st.plotly_chart(fig)
48
+ df = px.data.election()
49
+ geojson = px.data.election_geojson()
50
+ fig = px.choropleth_mapbox(
51
+ df,
52
+ geojson=geojson,
53
+ color="Bergeron",
54
+ locations="district",
55
+ featureidkey="properties.district",
56
+ center={"lat": 45.5517, "lon": -73.7073},
57
+ mapbox_style="carto-positron",
58
+ zoom=9,
59
+ )
60
+ st.plotly_chart(fig)
61
+ fig = make_subplots(
62
+ rows=2,
63
+ cols=2,
64
+ specs=[
65
+ [{"type": "surface"}, {"type": "surface"}],
66
+ [{"type": "surface"}, {"type": "surface"}],
67
  ],
68
  )
69
+ x = np.linspace(-5, 80, 10)
70
+ y = np.linspace(-5, 60, 10)
71
+ xGrid, yGrid = np.meshgrid(y, x)
72
+ z = xGrid**3 + yGrid**3
73
+ fig.add_trace(
74
+ go.Surface(x=x, y=y, z=z, colorscale="Viridis", showscale=False), row=1, col=1
75
+ )
76
+ fig.add_trace(
77
+ go.Surface(x=x, y=y, z=z, colorscale="RdBu", showscale=False), row=1, col=2
78
+ )
79
+ fig.add_trace(
80
+ go.Surface(x=x, y=y, z=z, colorscale="YlOrRd", showscale=False), row=2, col=1
81
+ )
82
+ fig.add_trace(
83
+ go.Surface(x=x, y=y, z=z, colorscale="YlGnBu", showscale=False), row=2, col=2
84
+ )
85
+ fig.update_layout(
86
+ title_text="3D subplots with different colorscales", height=800, width=800
87
+ )
88
+ st.plotly_chart(fig)
89
+ fig = px.scatter_3d(
90
+ px.data.iris(),
91
+ x="sepal_length",
92
+ y="sepal_width",
93
+ z="petal_width",
94
+ color="petal_length",
95
+ size="petal_length",
96
+ size_max=18,
97
+ symbol="species",
98
+ opacity=0.7,
99
+ )
100
+ fig.update_layout(margin=dict(l=0, r=0, b=0, t=0))
101
+ st.plotly_chart(fig)
102
 
103
 
104
  if __name__ == "__main__":