File size: 1,203 Bytes
3515308
 
 
10d2f3f
0741736
3515308
 
 
 
 
 
 
 
 
 
 
 
 
 
badb5a3
3515308
 
 
 
 
badb5a3
 
3515308
badb5a3
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
33
34
import gradio as gr
import pandas as pd

df = pd.read_csv('https://huggingface.co/datasets/stevhliu/quantization/raw/main/quantization.csv')

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(df, hardware=hardware, bits=bits)
    return filtered_df

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

demo.launch()