joheras commited on
Commit
b01556d
·
1 Parent(s): 43ddd05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -3
app.py CHANGED
@@ -1,11 +1,25 @@
1
  import gradio as gr
2
- from transformers import AutoModel
 
 
3
 
4
- model = AutoModel.from_pretrained("keras-io/timeseries_transformer_classification")
5
 
 
6
 
 
 
 
 
 
 
 
 
7
 
8
- iface = gr.Interface(fraud_detector,"dataframe",gr.outputs.Label(label="Fraud Level"))
 
 
 
9
 
 
10
 
11
  iface.launch()
 
1
  import gradio as gr
2
+ from huggingface_hub import from_pretrained_keras
3
+ import pandas as pd
4
+ import numpy as np
5
 
 
6
 
7
+ model = from_pretrained_keras("keras-io/timeseries_transformer_classification")
8
 
9
+ def detect_issue(df):
10
+ df = pd.read_csv('sample.csv',header=None)
11
+ pred = model.predict(df)[0]
12
+ problem = 'No problem'
13
+ if(np.argmax(pred)==1):
14
+ problem = 'Engine problem'
15
+ return problem, pred[1]
16
+
17
 
18
+ iface = gr.Interface(detect_issue,"dataframe",outputs=[
19
+ gr.outputs.Textbox(label="Engine issue"),
20
+ gr.outputs.Textbox(label="Engine issue score"),
21
+ ])
22
 
23
+ examples = [["examples/sample.csv"]]
24
 
25
  iface.launch()