File size: 881 Bytes
b931367
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr

def create_code_framework_selector(framework_specs, default_framework_constant):
    """
    Creates a reusable Gradio code framework selector component.

    Args:
        framework_specs (dict): A dictionary containing the specifications for each framework.
        default_framework_constant (str): The key for the default framework in the framework_specs dictionary.

    Returns:
        tuple: A tuple containing the framework dropdown and the framework description markdown components.
    """
    display_names = [d["display_name"] for d in framework_specs.values()]
    default_display_name = framework_specs[default_framework_constant]["display_name"]

    framework_dropdown = gr.Dropdown(
        choices=display_names,
        label="代码类型",
        value=default_display_name,
        interactive=True
    )

    return framework_dropdown