sraimund commited on
Commit
f32d83a
·
verified ·
1 Parent(s): 3c0ef47

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -2,11 +2,11 @@ import gradio as gr
2
  import torch
3
  import open_clip
4
 
5
- def predict(image):
6
  device = torch.device("cpu")
7
  model, _, preprocess = open_clip.create_model_and_transforms('ViT-L-14', pretrained='openai', device=device)
8
 
9
- image = preprocess().unsqueeze(0).to(device)
10
 
11
  with torch.amp.autocast(device_type=device.type):
12
  with torch.no_grad():
@@ -20,5 +20,5 @@ def predict(image):
20
 
21
  return "Map" if result == 1 else "No map"
22
 
23
- demo = gr.Interface(fn=predict, inputs=gr.Image(label="Input Image", type="pil"), outputs="text")
24
  demo.launch()
 
2
  import torch
3
  import open_clip
4
 
5
+ def predict(input_image):
6
  device = torch.device("cpu")
7
  model, _, preprocess = open_clip.create_model_and_transforms('ViT-L-14', pretrained='openai', device=device)
8
 
9
+ image = preprocess(input_image).unsqueeze(0).to(device)
10
 
11
  with torch.amp.autocast(device_type=device.type):
12
  with torch.no_grad():
 
20
 
21
  return "Map" if result == 1 else "No map"
22
 
23
+ demo = gr.Interface(fn=predict, inputs=gr.Image(label="Check whether the image is a map or not", type="pil"), outputs="text")
24
  demo.launch()