Spaces:
Runtime error
Runtime error
app
Browse files
app.py
CHANGED
@@ -8,17 +8,19 @@ model = from_pretrained_keras("keras-io/timeseries_transformer_classification")
|
|
8 |
|
9 |
def detect_issue(file):
|
10 |
df = pd.read_csv(file,header=None)
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
return
|
16 |
|
17 |
|
18 |
iface = gr.Interface(detect_issue,gr.inputs.File(label="csv file"),
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
22 |
# examples = ["sample.csv"],
|
23 |
)
|
24 |
|
|
|
8 |
|
9 |
def detect_issue(file):
|
10 |
df = pd.read_csv(file,header=None)
|
11 |
+
preds = model.predict(df)
|
12 |
+
result = []
|
13 |
+
for i,pred in enumerate(preds):
|
14 |
+
result.append(['Sample ' + str(i+1), np.argmax(pred),pred[np.argmax(pred)]]
|
15 |
+
return pd.DataFrame(result,header=['Sample','class','confidence']
|
16 |
|
17 |
|
18 |
iface = gr.Interface(detect_issue,gr.inputs.File(label="csv file"),
|
19 |
+
"dataframe",
|
20 |
+
#outputs=[
|
21 |
+
# gr.outputs.Textbox(label="Engine issue"),
|
22 |
+
# gr.outputs.Textbox(label="Engine issue score")],
|
23 |
+
examples=["sample.csv"]
|
24 |
# examples = ["sample.csv"],
|
25 |
)
|
26 |
|