davidanthony-ai
commited on
Commit
·
92a8156
1
Parent(s):
dafa1c9
gestion affichage nouveau mois
Browse files- components/fonctions_transcription.py +24 -24
- pages/Transcription.py +10 -0
- requirements.txt +1 -0
components/fonctions_transcription.py
CHANGED
@@ -127,33 +127,33 @@ def graphique_utilisation(data, username, annee_mois):
|
|
127 |
a =df_user[(df_user["usernames"] == username) & (df_user["Year_Month"] == annee_mois)]
|
128 |
a["Consommation_heures"] = a["durees_audio_sec"].cumsum()
|
129 |
a["Consommation_heures"] = a["Consommation_heures"].values / 3600
|
130 |
-
print(a["Consommation_heures"])
|
131 |
-
print(a["dates_transcription"])
|
132 |
fig = px.line(a, x='dates_transcription', y='Consommation_heures')
|
133 |
-
|
134 |
-
# Ajouter la limite de temps 20H = 72000 s
|
135 |
-
fig.add_shape(type="line",
|
136 |
-
x0=fig['data'][0]['x'][0],
|
137 |
-
x1=fig['data'][0]['x'][-1],
|
138 |
-
y0=20,
|
139 |
-
y1=20,
|
140 |
-
line=dict(color='red', width=2, dash='dash'))
|
141 |
-
|
142 |
-
# Afficher la légende de la limite SEUIL DE 20H = 72000 secondes
|
143 |
-
fig.add_annotation(x=fig['data'][0]['x'][-1],
|
144 |
-
y=20,
|
145 |
-
text="SEUIL DE 20H",
|
146 |
-
showarrow=False,
|
147 |
-
font=dict(color="red"),
|
148 |
-
xshift=-40, # Shift the label to the left
|
149 |
-
yshift=20) # Shift the label downwards
|
150 |
-
|
151 |
-
# Afficher la figure interactive
|
152 |
-
# fig.show()
|
153 |
-
|
154 |
# Calcul temps total de transcription en secondes du mois
|
155 |
temps = a["durees_audio_sec"].sum()
|
156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
158 |
|
159 |
def transcript(dict_user,username,user_group, audio_file,maintenant,Year_Month,quota_20H,model):
|
|
|
127 |
a =df_user[(df_user["usernames"] == username) & (df_user["Year_Month"] == annee_mois)]
|
128 |
a["Consommation_heures"] = a["durees_audio_sec"].cumsum()
|
129 |
a["Consommation_heures"] = a["Consommation_heures"].values / 3600
|
|
|
|
|
130 |
fig = px.line(a, x='dates_transcription', y='Consommation_heures')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
# Calcul temps total de transcription en secondes du mois
|
132 |
temps = a["durees_audio_sec"].sum()
|
133 |
+
if len(a["Consommation_heures"])!= 0 :
|
134 |
+
# Ajouter la limite de temps 20H = 72000 s
|
135 |
+
fig.add_shape(type="line",
|
136 |
+
x0=fig['data'][0]['x'][0],
|
137 |
+
x1=fig['data'][0]['x'][-1],
|
138 |
+
y0=20,
|
139 |
+
y1=20,
|
140 |
+
line=dict(color='red', width=2, dash='dash'))
|
141 |
+
|
142 |
+
# Afficher la légende de la limite SEUIL DE 20H = 72000 secondes
|
143 |
+
fig.add_annotation(x=fig['data'][0]['x'][-1],
|
144 |
+
y=20,
|
145 |
+
text="SEUIL DE 20H",
|
146 |
+
showarrow=False,
|
147 |
+
font=dict(color="red"),
|
148 |
+
xshift=-40, # Shift the label to the left
|
149 |
+
yshift=20) # Shift the label downwards
|
150 |
+
|
151 |
+
# Afficher la figure interactive
|
152 |
+
# fig.show()
|
153 |
+
return fig,temps
|
154 |
+
else:
|
155 |
+
return fig,temps
|
156 |
+
|
157 |
|
158 |
|
159 |
def transcript(dict_user,username,user_group, audio_file,maintenant,Year_Month,quota_20H,model):
|
pages/Transcription.py
CHANGED
@@ -11,9 +11,19 @@ from datetime import datetime as date
|
|
11 |
from datetime import timedelta as td
|
12 |
import components.fonctions_transcription as TRS
|
13 |
import boto3
|
|
|
|
|
|
|
14 |
|
|
|
|
|
|
|
|
|
15 |
|
|
|
16 |
|
|
|
|
|
17 |
|
18 |
#Region Paris
|
19 |
###region="eu-west-3"
|
|
|
11 |
from datetime import timedelta as td
|
12 |
import components.fonctions_transcription as TRS
|
13 |
import boto3
|
14 |
+
from dotenv import load_dotenv
|
15 |
+
import os
|
16 |
+
from deta import Deta
|
17 |
|
18 |
+
# ------------------------------------
|
19 |
+
# Read constants from environment file
|
20 |
+
# ------------------------------------
|
21 |
+
load_dotenv()
|
22 |
|
23 |
+
DETA_KEY = os.environ.get("DETA_KEY")
|
24 |
|
25 |
+
# Connect to Deta Base with your Data Key
|
26 |
+
#deta = Deta(st.secrets["data_key"])
|
27 |
|
28 |
#Region Paris
|
29 |
###region="eu-west-3"
|
requirements.txt
CHANGED
@@ -9,3 +9,4 @@ nbformat>=4.2.0
|
|
9 |
boto3
|
10 |
soundfile == 0.12.1
|
11 |
pydub
|
|
|
|
9 |
boto3
|
10 |
soundfile == 0.12.1
|
11 |
pydub
|
12 |
+
deta
|