-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHome.py
More file actions
38 lines (28 loc) · 1.03 KB
/
Copy pathHome.py
File metadata and controls
38 lines (28 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import streamlit as st
from pymongo import MongoClient
import pandas as pd
from dotenv import load_dotenv
import os
load_dotenv()
api_secret = os.getenv('API_SECRET')
# Set up MongoDB connection
client = MongoClient(api_secret)
db = client["AI-Challenge-ScoreMaster"]
users = db["users"]
results = db["results"]
# Writing the session state
if 'users' and 'results' not in st.session_state:
st.session_state.users = users
st.session_state.results = results
def load_evaluations_from_mongodb():
# Assuming you have a collection called "results" in your MongoDB
evaluations = results.find({}, {"_id": 0})
df = pd.DataFrame(evaluations)
return df
# Load all evaluations from MongoDB and display them in a table
def display_evaluation_table():
df = load_evaluations_from_mongodb()
st.dataframe(df, use_container_width=True, hide_index=True)
display_evaluation_table()
# TODO: Don't forget to add a model counter or an uploaded am date to delete all of the models that are 2 weeks
# Automatically from the database