llmappstudio / app.py
Praveen998's picture
Upload folder using huggingface_hub
a84d625
import streamlit as st
import pandas as pd
import numpy as np
import yfinance as yf
import altair as alt
import plotly.figure_factory as ff
import pydeck as pdk
from vega_datasets import data as vds
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from streamlit_image_comparison import image_comparison
def on_input_change():
user_input = st.session_state.user_input
st.session_state.past.append(user_input)
st.session_state.generated.append(
{"data": "The messages from Bot\nWith new line", "type": "normal"}
)
def on_btn_click():
del st.session_state.past[:]
del st.session_state.generated[:]
def main():
st.title(" 3D Visualisation")
z_data = pd.read_csv(
"https://raw.githubusercontent.com/plotly/datasets/master/api_docs/mt_bruno_elevation.csv"
)
fig = go.Figure(data=go.Surface(z=z_data, showscale=False))
fig.update_layout(
title="Mt Bruno Elevation",
width=400,
height=400,
margin=dict(t=40, r=0, l=20, b=20),
)
name = "default"
camera = dict(
up=dict(x=0, y=0, z=1),
center=dict(x=0, y=0, z=0),
eye=dict(x=1.25, y=1.25, z=1.25),
)
fig.update_layout(scene_camera=camera, title=name)
st.plotly_chart(fig)
df = px.data.election()
geojson = px.data.election_geojson()
fig = px.choropleth_mapbox(
df,
geojson=geojson,
color="Bergeron",
locations="district",
featureidkey="properties.district",
center={"lat": 45.5517, "lon": -73.7073},
mapbox_style="carto-positron",
zoom=9,
)
st.plotly_chart(fig)
fig = make_subplots(
rows=2,
cols=2,
specs=[
[{"type": "surface"}, {"type": "surface"}],
[{"type": "surface"}, {"type": "surface"}],
],
)
x = np.linspace(-5, 80, 10)
y = np.linspace(-5, 60, 10)
xGrid, yGrid = np.meshgrid(y, x)
z = xGrid**3 + yGrid**3
fig.add_trace(
go.Surface(x=x, y=y, z=z, colorscale="Viridis", showscale=False), row=1, col=1
)
fig.add_trace(
go.Surface(x=x, y=y, z=z, colorscale="RdBu", showscale=False), row=1, col=2
)
fig.add_trace(
go.Surface(x=x, y=y, z=z, colorscale="YlOrRd", showscale=False), row=2, col=1
)
fig.add_trace(
go.Surface(x=x, y=y, z=z, colorscale="YlGnBu", showscale=False), row=2, col=2
)
fig.update_layout(
title_text="3D subplots with different colorscales", height=800, width=800
)
st.plotly_chart(fig)
fig = px.scatter_3d(
px.data.iris(),
x="sepal_length",
y="sepal_width",
z="petal_width",
color="petal_length",
size="petal_length",
size_max=18,
symbol="species",
opacity=0.7,
)
fig.update_layout(margin=dict(l=0, r=0, b=0, t=0))
st.plotly_chart(fig)
if __name__ == "__main__":
main()