Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,6 +18,7 @@ from PIL import Image
|
|
| 18 |
import torch
|
| 19 |
import torch.nn.functional as F
|
| 20 |
import time
|
|
|
|
| 21 |
|
| 22 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 23 |
|
|
@@ -33,6 +34,5 @@ def predict(image):
|
|
| 33 |
label = model.config.id2label[predicted_class_idx].split(",")[0]
|
| 34 |
time.sleep(2)
|
| 35 |
return {label: float(predicted_class_prob)}
|
| 36 |
-
import gradio as gr
|
| 37 |
|
| 38 |
gr.Interface(predict, gr.Image(type="pil"), "label").launch()
|
|
|
|
| 18 |
import torch
|
| 19 |
import torch.nn.functional as F
|
| 20 |
import time
|
| 21 |
+
import gradio as gr
|
| 22 |
|
| 23 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 24 |
|
|
|
|
| 34 |
label = model.config.id2label[predicted_class_idx].split(",")[0]
|
| 35 |
time.sleep(2)
|
| 36 |
return {label: float(predicted_class_prob)}
|
|
|
|
| 37 |
|
| 38 |
gr.Interface(predict, gr.Image(type="pil"), "label").launch()
|