Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import pandas as pd
|
3 |
+
|
4 |
+
def filter_by_hardware_or_bits(df, hardware=None, bits=None):
|
5 |
+
if hardware is None and bits is None:
|
6 |
+
raise ValueError("At least one of 'hardware' or 'bits' must be specified.")
|
7 |
+
|
8 |
+
hardware_mask = df['hardware'] == hardware if hardware is not None else pd.Series([True] * len(df))
|
9 |
+
bits_mask = df['bits'] == bits if bits is not None else pd.Series([True] * len(df))
|
10 |
+
|
11 |
+
combined_mask = hardware_mask & bits_mask
|
12 |
+
|
13 |
+
filtered_df = df[combined_mask]
|
14 |
+
|
15 |
+
return filtered_df
|
16 |
+
|
17 |
+
def filter_dataframe(hardware, bits):
|
18 |
+
filtered_df = filter_by_hardware_or_bits(quantization_data, hardware=hardware, bits=bits)
|
19 |
+
return filtered_df
|
20 |
+
|
21 |
+
demo = gr.Interface(
|
22 |
+
fn=filter_dataframe,
|
23 |
+
inputs=[
|
24 |
+
gr.Dropdown(choices=quantization_data['hardware'].unique().tolist(), label="hardware"),
|
25 |
+
gr.Dropdown(choices=quantization_data['bits'].unique().tolist(), label="bits"),
|
26 |
+
],
|
27 |
+
outputs=gr.Dataframe(headers=list(quantization_data.columns)),
|
28 |
+
title="Quantization methods",
|
29 |
+
description="Pick a quantization method based on your hardware and k-bit quantization."
|
30 |
+
)
|
31 |
+
|
32 |
+
demo.launch()
|