import gradio as gr from datasets import load_dataset import pandas as pd db = load_dataset("nicholasKluge/model-library", split='main') db = db.to_pandas() def display_model_information(value): """ This function will display the model information for the selected model """ # If the value is empty, return None if value == '': return None, None # Get the model information info = db.iloc[int(db[db.model_name_string == value].index.values)] # Create the model details and model info model_details = f"""## Model Details - Name: {info.model_name_url} - Model Size: {info.model_size_string} - Dataset: {info.dataset} - Input/Output Format: {info.data_type} - Research Field: {info.research_field} - Contains an Impact Assessment: {info.risks_and_limitations} - Associated Risks: ☣️ {info.risk_types} ☣️ - Date of Publication: {info.publication_date} - Organization: {info.organization_and_url} ({info.institution_type}) - Country/Origin: {info.country} - License: {info.license} - Publication: {info.paper_name_url} """ model_info = f"""## Description {info.model_description} ## Organization {info.organization_info} """ return model_details, model_info with open('risks_list.md', 'rb') as f: risk_text = f.read().decode('utf-8')[44:] with gr.Blocks(theme='HaleyCH/HaleyCH_Theme') as demo: gr.Markdown("""