File size: 1,162 Bytes
3515308
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
import pandas as pd

def filter_by_hardware_or_bits(df, hardware=None, bits=None):
    if hardware is None and bits is None:
        raise ValueError("At least one of 'hardware' or 'bits' must be specified.")
    
    hardware_mask = df['hardware'] == hardware if hardware is not None else pd.Series([True] * len(df))
    bits_mask = df['bits'] == bits if bits is not None else pd.Series([True] * len(df))
    
    combined_mask = hardware_mask & bits_mask
    
    filtered_df = df[combined_mask]
    
    return filtered_df

def filter_dataframe(hardware, bits):
    filtered_df = filter_by_hardware_or_bits(quantization_data, hardware=hardware, bits=bits)
    return filtered_df

demo = gr.Interface(
    fn=filter_dataframe,
    inputs=[
        gr.Dropdown(choices=quantization_data['hardware'].unique().tolist(), label="hardware"),
        gr.Dropdown(choices=quantization_data['bits'].unique().tolist(), label="bits"),
    ],
    outputs=gr.Dataframe(headers=list(quantization_data.columns)),
    title="Quantization methods",
    description="Pick a quantization method based on your hardware and k-bit quantization."
)

demo.launch()