stevhliu's picture
stevhliu HF staff
Update app.py
badb5a3 verified
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()