Skip to content

Commit

Permalink
add percentage to pies
Browse files Browse the repository at this point in the history
  • Loading branch information
rambip committed Jun 3, 2024
1 parent a5a0b7b commit f4c24f7
Showing 1 changed file with 37 additions and 35 deletions.
72 changes: 37 additions & 35 deletions site.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


data : pd.DataFrame = pd.read_csv("results/telecom_paris.csv", header=None)
print(data[27])
data = data.drop(index=[0,1,2])
N = len(data)

Expand Down Expand Up @@ -49,6 +48,10 @@ def render_question(i):
render_choices(q["choices"])


def pie(values, labels):
plt.pie(values, labels=labels, autopct=lambda x:f"{x:1.1f} %")


doc.asis('<!DOCTYPE html>')
with tag('html'):
with tag('head'):
Expand All @@ -70,8 +73,8 @@ def render_question(i):

render_question(1)
fig, ax = plt.subplots()
count = data[5].astype(float).value_counts().sort_index()
plt.pie(count.values, labels=count.index)
count = data[5].astype(float).value_counts().sort_index()/N
pie(count.values, labels=count.index)
plt.title('Elo de chatGPT')
plt.close(fig)
plot_to_img(fig)
Expand All @@ -88,32 +91,32 @@ def render_question(i):

render_question(3)
fig, ax = plt.subplots()
count = data[10].value_counts().sort_index()
plt.pie(count.values, labels=["non", "oui"])
count = data[10].value_counts().sort_index()/N
pie(count.values, labels=["non", "oui"])
plt.title('RLHF')
plt.close(fig)
plot_to_img(fig)


render_question(4)
fig, ax = plt.subplots()
count = data[11].astype(float).value_counts().sort_index()
count = data[11].astype(float).value_counts().sort_index()/N
plt.bar(count.index, count.values)
plt.title('Timeline openAI')
plt.close(fig)
plot_to_img(fig)

render_question(5)
fig, ax = plt.subplots()
count = data[12].astype(float).value_counts().sort_index()
count = data[12].astype(float).value_counts().sort_index()/N
plt.bar(count.index, count.values)
plt.title('avis des Experts')
plt.close(fig)
plot_to_img(fig)

render_question(6)
fig, ax = plt.subplots()
count = data[13].value_counts().sort_index()
count = data[13].value_counts().sort_index()/N
plt.bar(count.index, count.values)
plt.title('Risques')
plt.close(fig)
Expand All @@ -122,116 +125,115 @@ def render_question(i):

render_question(7)
fig, ax = plt.subplots()
count = data[14].value_counts().sort_index()
count = data[14].value_counts().sort_index()/N
plt.bar(count.index, count.values)
plt.title('Cyber')
plt.close(fig)
plot_to_img(fig)

fig, ax = plt.subplots()
count = data[15].value_counts().sort_index()
count = data[15].value_counts().sort_index()/N
plt.bar(count.index, count.values)
plt.title('Crash')
plt.close(fig)
plot_to_img(fig)

fig, ax = plt.subplots()
count = data[16].value_counts().sort_index()
count = data[16].value_counts().sort_index()/N
plt.bar(count.index, count.values)
plt.title('Perte contrôle')
plt.close(fig)
plot_to_img(fig)

fig, ax = plt.subplots()
count = data[17].value_counts().sort_index()
count = data[17].value_counts().sort_index()/N
plt.bar(count.index, count.values)
plt.title('Automatisation')
plt.close(fig)
plot_to_img(fig)

render_question(8)
fig, ax = plt.subplots()
count = data[18].value_counts().sort_index()
plt.pie(count.values, labels=["non", "oui"])
count = data[18].value_counts().sort_index()/N
pie(count.values, labels=["non", "oui"])
plt.title('ChatGPT')
plt.close(fig)
plot_to_img(fig)

render_question(9)
fig, ax = plt.subplots()
count = data[19].value_counts().sort_index()
plt.pie(count.values, labels=["non", "oui"])
count = data[19].value_counts().sort_index()/N
pie(count.values, labels=["non", "oui"])
plt.title('API GPT4')
plt.close(fig)
plot_to_img(fig)

render_question(10)
fig, ax = plt.subplots()
count = data[20].value_counts().sort_index()
plt.pie(count.values, labels=["non", "oui"])
count = data[20].value_counts().sort_index()/N
pie(count.values, labels=["non", "oui"])
plt.title('Sûreté IA juridique')
plt.close(fig)
plot_to_img(fig)

render_question(11)
fig, ax = plt.subplots()
count = data[21].value_counts().sort_index()
plt.pie(count.values, labels=["non", "oui"])
count = data[21].value_counts().sort_index()/N
pie(count.values, labels=["non", "oui"])
plt.title('Sûreté IA recherche')
plt.close(fig)
plot_to_img(fig)

render_question(12)
fig, ax = plt.subplots()
count = data[22].value_counts().sort_index()
plt.pie(count.values, labels=["non", "oui"])
count = data[22].value_counts().sort_index()/N
pie(count.values, labels=["non", "oui"])
plt.title('ralentir création')
plt.close(fig)
plot_to_img(fig)

render_question(13)
fig, ax = plt.subplots()
count = data[23].value_counts().sort_index()
plt.pie(count.values, labels=["non", "oui"])
count = data[23].value_counts().sort_index()/N
pie(count.values, labels=["non", "oui"])
plt.title('ralentir déploiement')
plt.close(fig)
plot_to_img(fig)


render_question(14)
fig, ax = plt.subplots()
count = data[24].value_counts().sort_index()
plt.pie(count.values, labels=["non", "oui"])
count = data[24].value_counts().sort_index()/N
pie(count.values, labels=["non", "oui"])
plt.title('EU AI Act')
plt.close(fig)
plot_to_img(fig)

fig, ax = plt.subplots()
count = data[25].value_counts().sort_index()
plt.pie(count.values, labels=["non", "oui"])
count = data[25].value_counts().sort_index()/N
pie(count.values, labels=["non", "oui"])
plt.title('Séoul')
plt.close(fig)
plot_to_img(fig)

fig, ax = plt.subplots()
count = data[26].value_counts().sort_index()
plt.pie(count.values, labels=["non", "oui"])
count = data[26].value_counts().sort_index()/N
pie(count.values, labels=["non", "oui"])
plt.title('PauseAI')
plt.close(fig)
plot_to_img(fig)

fig, ax = plt.subplots()
count = data[27].value_counts().sort_index()
plt.pie(count.values, labels=["non", "oui"])
count = data[27].value_counts().sort_index()/N
pie(count.values, labels=["non", "oui"])
plt.title('CeSIA')
plt.close(fig)
plot_to_img(fig)

render_question(15)
fig, ax = plt.subplots()
count = data[28].value_counts().sort_index()
print(count)
plt.pie(count.values, labels=["non", "oui"])
count = data[28].value_counts().sort_index()/N
pie(count.values, labels=["non", "oui"])
plt.title('Cours')
plt.close(fig)
plot_to_img(fig)
Expand Down

0 comments on commit f4c24f7

Please sign in to comment.