Spaces:
Runtime error
Runtime error
import gradio as gr | |
from huggingface_hub import from_pretrained_keras | |
import pandas as pd | |
import numpy as np | |
model = from_pretrained_keras("keras-io/timeseries_transformer_classification") | |
def detect_issue(file): | |
df = pd.read_csv(file,header=None) | |
preds = model.predict(df) | |
result = [] | |
for i,pred in enumerate(preds): | |
result.append(['Sample ' + str(i+1), np.argmax(pred),pred[np.argmax(pred)]] | |
return pd.DataFrame(result,header=['Sample','class','confidence'] | |
iface = gr.Interface(detect_issue,gr.inputs.File(label="csv file"), | |
"dataframe", | |
#outputs=[ | |
# gr.outputs.Textbox(label="Engine issue"), | |
# gr.outputs.Textbox(label="Engine issue score")], | |
examples=["sample.csv"] | |
# examples = ["sample.csv"], | |
) | |
iface.launch() | |