Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,9 @@
|
|
|
|
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,9 +66,9 @@ def predict(img) -> Tuple[Dict, float]:
|
|
65 |
### 4. Gradio app ###
|
66 |
|
67 |
# Create title, description and article strings
|
68 |
-
title = "
|
69 |
-
description = "An app to predict
|
70 |
-
|
71 |
|
72 |
# Create examples list from "examples/" directory
|
73 |
# example_list = [["examples/" + example] for example in os.listdir("examples")]
|
@@ -78,12 +79,13 @@ demo = gr.Interface(
|
|
78 |
inputs=gr.Image(type="pil"),
|
79 |
outputs=[
|
80 |
gr.Label(num_top_classes=5, label="Predictions"),
|
81 |
-
gr.
|
82 |
],
|
83 |
# examples=example_list,
|
84 |
title=title,
|
85 |
description=description,
|
|
|
86 |
)
|
87 |
|
88 |
# Launch the app!
|
89 |
-
demo.launch(
|
|
|
1 |
+
# %%writefile demos/app.py
|
2 |
### 1. Imports and class names setup ###
|
3 |
import gradio as gr
|
4 |
import os
|
5 |
import torch
|
6 |
+
# from model import TinyCNN
|
7 |
from timeit import default_timer as timer
|
8 |
from typing import Tuple, Dict
|
9 |
import torch
|
|
|
66 |
### 4. Gradio app ###
|
67 |
|
68 |
# Create title, description and article strings
|
69 |
+
title = "Expression Detection"
|
70 |
+
description = "An app to predict emotions from the list.[Angry, Disgust, Fear, Happy, Neutral, Sad, Surprise]"
|
71 |
+
article = "Created as a college project."
|
72 |
|
73 |
# Create examples list from "examples/" directory
|
74 |
# example_list = [["examples/" + example] for example in os.listdir("examples")]
|
|
|
79 |
inputs=gr.Image(type="pil"),
|
80 |
outputs=[
|
81 |
gr.Label(num_top_classes=5, label="Predictions"),
|
82 |
+
gr.Number(label="Prediction time (s)"),
|
83 |
],
|
84 |
# examples=example_list,
|
85 |
title=title,
|
86 |
description=description,
|
87 |
+
article=article,
|
88 |
)
|
89 |
|
90 |
# Launch the app!
|
91 |
+
demo.launch()
|