Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- README.md +6 -0
- app/__pycache__/api.cpython-311.pyc +0 -0
- app/api.py +2 -2
- app/app.py +1 -1
- app/views/__pycache__/admin.cpython-311.pyc +0 -0
- app/views/__pycache__/aide_telephonique.cpython-311.pyc +0 -0
- app/views/__pycache__/dashboard.cpython-311.pyc +0 -0
- app/views/__pycache__/home.cpython-311.pyc +0 -0
- app/views/admin.py +3 -3
- app/views/dashboard.py +10 -0
- src/__pycache__/speech_to_text.cpython-311.pyc +0 -0
- src/security/__pycache__/security_check.cpython-311.pyc +0 -0
- src/security/__pycache__/security_report.cpython-311.pyc +0 -0
README.md
CHANGED
|
@@ -56,3 +56,9 @@ SmartRescue est une application conçue pour assister les opérateurs d'urgence
|
|
| 56 |
3. Accédez à l'interface utilisateur via votre navigateur à l'adresse `http://localhost:8501` si celui-ci ne s'est pas lancé directement.
|
| 57 |
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
3. Accédez à l'interface utilisateur via votre navigateur à l'adresse `http://localhost:8501` si celui-ci ne s'est pas lancé directement.
|
| 57 |
|
| 58 |
|
| 59 |
+
|
| 60 |
+
## Utilisation via Hugging Face
|
| 61 |
+
|
| 62 |
+
L'application est également disponible sur un space Hugging Face à l'adresse suivante : [https://huggingface.co/spaces/maxenceLIOGIER/SmartRescue](https://huggingface.co/spaces/maxenceLIOGIER/SmartRescue).
|
| 63 |
+
|
| 64 |
+
Cependant, nous n'avons pas réussi à connecter le micro sur cette plateforme. Pour une utilisation complète, il faudra faire tourner l'application en local comme décrit ci-dessus.
|
app/__pycache__/api.cpython-311.pyc
CHANGED
|
Binary files a/app/__pycache__/api.cpython-311.pyc and b/app/__pycache__/api.cpython-311.pyc differ
|
|
|
app/api.py
CHANGED
|
@@ -8,7 +8,7 @@ from fastapi import FastAPI, Query
|
|
| 8 |
from fastapi.responses import RedirectResponse
|
| 9 |
|
| 10 |
# Chemin de la base de données
|
| 11 |
-
dbpath = Path(__file__).parent.parent / "database" / "
|
| 12 |
|
| 13 |
# instanciation de l'API FastAPI
|
| 14 |
api = FastAPI(
|
|
@@ -30,7 +30,7 @@ async def root():
|
|
| 30 |
# ne spécifie pas de date de début ou de fin
|
| 31 |
base_query = """
|
| 32 |
SELECT log.id_log, log.timestamp, prompt.prompt, prompt.response,
|
| 33 |
-
status.status, origin.
|
| 34 |
FROM log
|
| 35 |
LEFT JOIN prompt ON log.id_prompt = prompt.id_prompt
|
| 36 |
LEFT JOIN status ON log.id_status = status.id_status
|
|
|
|
| 8 |
from fastapi.responses import RedirectResponse
|
| 9 |
|
| 10 |
# Chemin de la base de données
|
| 11 |
+
dbpath = Path(__file__).parent.parent / "database" / "db_logsv2.db"
|
| 12 |
|
| 13 |
# instanciation de l'API FastAPI
|
| 14 |
api = FastAPI(
|
|
|
|
| 30 |
# ne spécifie pas de date de début ou de fin
|
| 31 |
base_query = """
|
| 32 |
SELECT log.id_log, log.timestamp, prompt.prompt, prompt.response,
|
| 33 |
+
status.status, origin.origin AS origin
|
| 34 |
FROM log
|
| 35 |
LEFT JOIN prompt ON log.id_prompt = prompt.id_prompt
|
| 36 |
LEFT JOIN status ON log.id_status = status.id_status
|
app/app.py
CHANGED
|
@@ -90,7 +90,7 @@ def main():
|
|
| 90 |
selected = option_menu(
|
| 91 |
menu_title="Navigation",
|
| 92 |
options=["Home", "Aide téléphonique", "Dashboard", "Admin"],
|
| 93 |
-
icons=["house", "phone", "bar-chart", "
|
| 94 |
default_index=0,
|
| 95 |
)
|
| 96 |
|
|
|
|
| 90 |
selected = option_menu(
|
| 91 |
menu_title="Navigation",
|
| 92 |
options=["Home", "Aide téléphonique", "Dashboard", "Admin"],
|
| 93 |
+
icons=["house", "phone", "bar-chart", "key"],
|
| 94 |
default_index=0,
|
| 95 |
)
|
| 96 |
|
app/views/__pycache__/admin.cpython-311.pyc
CHANGED
|
Binary files a/app/views/__pycache__/admin.cpython-311.pyc and b/app/views/__pycache__/admin.cpython-311.pyc differ
|
|
|
app/views/__pycache__/aide_telephonique.cpython-311.pyc
CHANGED
|
Binary files a/app/views/__pycache__/aide_telephonique.cpython-311.pyc and b/app/views/__pycache__/aide_telephonique.cpython-311.pyc differ
|
|
|
app/views/__pycache__/dashboard.cpython-311.pyc
CHANGED
|
Binary files a/app/views/__pycache__/dashboard.cpython-311.pyc and b/app/views/__pycache__/dashboard.cpython-311.pyc differ
|
|
|
app/views/__pycache__/home.cpython-311.pyc
CHANGED
|
Binary files a/app/views/__pycache__/home.cpython-311.pyc and b/app/views/__pycache__/home.cpython-311.pyc differ
|
|
|
app/views/admin.py
CHANGED
|
@@ -9,7 +9,7 @@ from src.security.security_report import SecurityReport
|
|
| 9 |
|
| 10 |
from views.home import arret_enregistrement
|
| 11 |
|
| 12 |
-
db_path = Path(__file__).parent.parent.parent / "database" / "
|
| 13 |
|
| 14 |
query = """
|
| 15 |
SELECT
|
|
@@ -18,7 +18,7 @@ SELECT
|
|
| 18 |
prompt.prompt,
|
| 19 |
prompt.response,
|
| 20 |
status.status,
|
| 21 |
-
origin.
|
| 22 |
FROM log
|
| 23 |
LEFT JOIN prompt ON log.id_prompt = prompt.id_prompt
|
| 24 |
LEFT JOIN status ON log.id_status = status.id_status
|
|
@@ -109,7 +109,7 @@ def adm_page():
|
|
| 109 |
prompt.prompt,
|
| 110 |
prompt.response,
|
| 111 |
status.status,
|
| 112 |
-
origin.
|
| 113 |
FROM log
|
| 114 |
LEFT JOIN prompt ON log.id_prompt = prompt.id_prompt
|
| 115 |
LEFT JOIN status ON log.id_status = status.id_status
|
|
|
|
| 9 |
|
| 10 |
from views.home import arret_enregistrement
|
| 11 |
|
| 12 |
+
db_path = Path(__file__).parent.parent.parent / "database" / "db_logsv2.db"
|
| 13 |
|
| 14 |
query = """
|
| 15 |
SELECT
|
|
|
|
| 18 |
prompt.prompt,
|
| 19 |
prompt.response,
|
| 20 |
status.status,
|
| 21 |
+
origin.origin AS origin
|
| 22 |
FROM log
|
| 23 |
LEFT JOIN prompt ON log.id_prompt = prompt.id_prompt
|
| 24 |
LEFT JOIN status ON log.id_status = status.id_status
|
|
|
|
| 109 |
prompt.prompt,
|
| 110 |
prompt.response,
|
| 111 |
status.status,
|
| 112 |
+
origin.origin AS origin
|
| 113 |
FROM log
|
| 114 |
LEFT JOIN prompt ON log.id_prompt = prompt.id_prompt
|
| 115 |
LEFT JOIN status ON log.id_status = status.id_status
|
app/views/dashboard.py
CHANGED
|
@@ -28,6 +28,16 @@ def track_metrics(latency, token_count):
|
|
| 28 |
|
| 29 |
def get_metrics():
|
| 30 |
"""Retourne les métriques moyennes"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
queries = max(
|
| 32 |
len(st.session_state.metrics["latency_history"]), 1
|
| 33 |
) # éviter division par zéro
|
|
|
|
| 28 |
|
| 29 |
def get_metrics():
|
| 30 |
"""Retourne les métriques moyennes"""
|
| 31 |
+
|
| 32 |
+
# Initialiser les métriques globales si elles n'existent pas déja
|
| 33 |
+
if "metrics" not in st.session_state:
|
| 34 |
+
st.session_state.metrics = {
|
| 35 |
+
"total_queries": 0,
|
| 36 |
+
"latency_history": [],
|
| 37 |
+
"cost_history": [],
|
| 38 |
+
"carbon_history": [],
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
queries = max(
|
| 42 |
len(st.session_state.metrics["latency_history"]), 1
|
| 43 |
) # éviter division par zéro
|
src/__pycache__/speech_to_text.cpython-311.pyc
CHANGED
|
Binary files a/src/__pycache__/speech_to_text.cpython-311.pyc and b/src/__pycache__/speech_to_text.cpython-311.pyc differ
|
|
|
src/security/__pycache__/security_check.cpython-311.pyc
CHANGED
|
Binary files a/src/security/__pycache__/security_check.cpython-311.pyc and b/src/security/__pycache__/security_check.cpython-311.pyc differ
|
|
|
src/security/__pycache__/security_report.cpython-311.pyc
CHANGED
|
Binary files a/src/security/__pycache__/security_report.cpython-311.pyc and b/src/security/__pycache__/security_report.cpython-311.pyc differ
|
|
|