Spaces:
Runtime error
Runtime error
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +9 -47
src/streamlit_app.py
CHANGED
|
@@ -26,51 +26,13 @@ def load_data():
|
|
| 26 |
|
| 27 |
df_human, df_minimlist, df_cheerleader, df_poet = load_data()
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
)
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
"Minimalist": df_minimlist,
|
| 39 |
-
"Cheerleader": df_cheerleader,
|
| 40 |
-
"Poet": df_poet
|
| 41 |
-
}
|
| 42 |
-
df_ai = persona_map[selected_persona]
|
| 43 |
-
|
| 44 |
-
sensitivity = st.slider("Perturbation Sensitivity (Simulated)", 0.0, 1.0, 0.5)
|
| 45 |
-
|
| 46 |
-
import plotly.graph_objects as go
|
| 47 |
-
from plotly.subplots import make_subplots
|
| 48 |
-
|
| 49 |
-
fig = make_subplots(rows=2, cols=1, shared_xaxes=True, vertical_spacing=0.1,
|
| 50 |
-
subplot_titles=("Human: Big Flame", f"AI: {selected_persona}"))
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
def create_strip(df, row_num, color_scale):
|
| 54 |
-
adjusted_values = df['tokens_est'] * (1 + sensitivity)
|
| 55 |
-
|
| 56 |
-
return go.Heatmap(
|
| 57 |
-
z=[adjusted_values],
|
| 58 |
-
x=df['turn'],
|
| 59 |
-
colorscale=color_scale,
|
| 60 |
-
showscale=False,
|
| 61 |
-
hovertext=df['words'],
|
| 62 |
-
)
|
| 63 |
-
|
| 64 |
-
fig.add_trace(create_strip(df_human, 1, 'Hot'), row=1, col=1)
|
| 65 |
-
|
| 66 |
-
fig.add_trace(create_strip(df_ai, 2, 'Teal'), row=2, col=1)
|
| 67 |
-
|
| 68 |
-
fig.update_layout(
|
| 69 |
-
height=300,
|
| 70 |
-
margin=dict(l=20, r=20, t=40, b=20),
|
| 71 |
-
xaxis2_title="Turn Number"
|
| 72 |
-
)
|
| 73 |
-
fig.update_yaxes(showticklabels=False)
|
| 74 |
-
|
| 75 |
-
st.plotly_chart(fig, use_container_width=True)
|
| 76 |
|
|
|
|
| 26 |
|
| 27 |
df_human, df_minimlist, df_cheerleader, df_poet = load_data()
|
| 28 |
|
| 29 |
+
def normalize_time(df):
|
| 30 |
+
df["t_norm"] = df.index /
|
| 31 |
+
(len(df) - 1)
|
| 32 |
+
return df
|
| 33 |
+
|
| 34 |
+
df_human = normalize_time(df_human)
|
| 35 |
+
df_minimlist = normalize_time(df_minimlist)
|
| 36 |
+
df_cheerleader = normalize_time(df_cheerleader)
|
| 37 |
+
df_poet = normalize_time(df_poet)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|