File size: 975 Bytes
43ddd05
b01556d
 
 
43ddd05
 
b01556d
43ddd05
736f47f
 
14fa378
 
 
114644e
4cec8ec
b01556d
43ddd05
736f47f
14fa378
 
 
 
2d6752c
e94f591
 
9e16be5
de7f225
43ddd05
 
4e2a9b6
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
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,columns=['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","sample2.csv"], title="Classification of Ford Motor data",
	description = "Model for predicting issues in Ford engines.",
        article = "Author: <a href=\"https://huggingface.co./joheras\">Jónathan Heras</a>"
#	examples = ["sample.csv"],
)


iface.launch()