Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,8 @@
|
|
| 1 |
-
# %%writefile demos/app.py
|
| 2 |
### 1. Imports and class names setup ###
|
| 3 |
import gradio as gr
|
| 4 |
import os
|
| 5 |
import torch
|
| 6 |
-
|
| 7 |
from timeit import default_timer as timer
|
| 8 |
from typing import Tuple, Dict
|
| 9 |
import torch
|
|
@@ -66,12 +65,12 @@ def predict(img) -> Tuple[Dict, float]:
|
|
| 66 |
### 4. Gradio app ###
|
| 67 |
|
| 68 |
# Create title, description and article strings
|
| 69 |
-
title = "
|
| 70 |
-
description = "An app to predict
|
| 71 |
-
|
| 72 |
|
| 73 |
# Create examples list from "examples/" directory
|
| 74 |
-
|
| 75 |
|
| 76 |
# Create Gradio interface
|
| 77 |
demo = gr.Interface(
|
|
@@ -81,10 +80,10 @@ demo = gr.Interface(
|
|
| 81 |
gr.Label(num_top_classes=5, label="Predictions"),
|
| 82 |
gr.Number(label="Prediction time (s)"),
|
| 83 |
],
|
| 84 |
-
|
| 85 |
title=title,
|
| 86 |
description=description,
|
| 87 |
-
|
| 88 |
)
|
| 89 |
|
| 90 |
# Launch the app!
|
|
|
|
|
|
|
| 1 |
### 1. Imports and class names setup ###
|
| 2 |
import gradio as gr
|
| 3 |
import os
|
| 4 |
import torch
|
| 5 |
+
from model import TinyCNN
|
| 6 |
from timeit import default_timer as timer
|
| 7 |
from typing import Tuple, Dict
|
| 8 |
import torch
|
|
|
|
| 65 |
### 4. Gradio app ###
|
| 66 |
|
| 67 |
# Create title, description and article strings
|
| 68 |
+
title = "Wafer Defect Detection"
|
| 69 |
+
description = "An app to predict Wafer Defects in semiconductors.[Center, Donut, Edge-Loc, Edge-Ring, Loc, Near-full, Random, Scratch, none]"
|
| 70 |
+
|
| 71 |
|
| 72 |
# Create examples list from "examples/" directory
|
| 73 |
+
example_list = [["example/" + example] for example in os.listdir("example")]
|
| 74 |
|
| 75 |
# Create Gradio interface
|
| 76 |
demo = gr.Interface(
|
|
|
|
| 80 |
gr.Label(num_top_classes=5, label="Predictions"),
|
| 81 |
gr.Number(label="Prediction time (s)"),
|
| 82 |
],
|
| 83 |
+
examples=example_list,
|
| 84 |
title=title,
|
| 85 |
description=description,
|
| 86 |
+
|
| 87 |
)
|
| 88 |
|
| 89 |
# Launch the app!
|