from github import Github import os import streamlit as st import datetime import plotly.figure_factory as ff import pandas as pd import math st.set_page_config(layout="wide") string1 = f"""link""" g = Github(os.environ.get('github')) inference_repo = g.get_repo("bigcode-project/bigcode-inference-benchmark") df = list() for milestone in inference_repo.get_milestones(): desc = dict() for line in milestone.description.split('\n'): tmp = line.split(":") desc[tmp[0].lower()] = tmp[1].lower().strip() df.append(dict(Task=milestone.title, Start=desc['start date'], Finish=milestone.due_on.strftime('%Y-%m-%d'), Resource=desc['status'], Description=desc['leader'])) colors = {'not started': 'rgb(220, 0, 0)', 'incomplete': (1, 0.9, 0.16), 'complete': 'rgb(0, 255, 100)'} fig = ff.create_gantt(df, colors=colors, index_col='Resource', show_colorbar=True, show_hover_fill=True, title="BigCode planning") fig.update_xaxes(ticks= "outside", ticklabelmode= "period", tickformat="%b", tickcolor= "black", ticklen=10, range=[datetime.datetime(2013, 10, 17), datetime.datetime(2013, 11, 20)], minor=dict( ticklen=4, dtick=7*24*60*60*1000, tick0="2023-01-01", griddash='dot', gridcolor='white') ) periods = pd.date_range(df[0]["Start"],df[0]["Finish"], freq='1D') center_pos = math.floor(len(periods) / 2) x_dates = periods[center_pos] fig.add_annotation({ "x": x_dates, "y": 0, "text": string1, "align": "center", "showarrow":False, }) fig.update_layout(xaxis_range=[datetime.datetime(2022, 12, 30), datetime.datetime(2023, 4, 2)]) fig.update_yaxes(automargin=True) fig.layout.xaxis.rangeselector = None st.write(fig.layout.yaxis) fig.add_vline(x=datetime.datetime.now().strftime('%Y-%m-%d'), line_width=3, line_dash="dash", line_color="green") st.plotly_chart(fig, use_container_width=True)