Spaces:
Runtime error
Runtime error
Create app_mlflow.py
Browse files- app_mlflow.py +30 -0
app_mlflow.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# app.py
|
2 |
+
import streamlit as st
|
3 |
+
import mlflow
|
4 |
+
import pandas as pd
|
5 |
+
|
6 |
+
# Set the MLflow tracking URI (e.g., local file system or a remote server)
|
7 |
+
mlflow.set_tracking_uri("http://localhost:5000")
|
8 |
+
|
9 |
+
def main():
|
10 |
+
st.title("Streamlit and MLflow Integration")
|
11 |
+
|
12 |
+
# Retrieve the list of experiments
|
13 |
+
experiments = mlflow.list_experiments()
|
14 |
+
experiment_names = [exp.name for exp in experiments]
|
15 |
+
experiment_id_map = {exp.name: exp.experiment_id for exp in experiments}
|
16 |
+
|
17 |
+
# Create a dropdown menu to select an experiment
|
18 |
+
selected_experiment = st.selectbox("Select an experiment:", experiment_names)
|
19 |
+
|
20 |
+
# Get the runs for the selected experiment
|
21 |
+
if selected_experiment:
|
22 |
+
experiment_id = experiment_id_map[selected_experiment]
|
23 |
+
runs = mlflow.search_runs(experiment_ids=[experiment_id])
|
24 |
+
|
25 |
+
# Display the runs in a table
|
26 |
+
st.write("Runs for the selected experiment:")
|
27 |
+
st.write(runs)
|
28 |
+
|
29 |
+
if __name__ == "__main__":
|
30 |
+
main()
|