Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
import argparse
|
2 |
import json
|
3 |
import time
|
4 |
from PIL import Image
|
@@ -6,9 +5,6 @@ import torch
|
|
6 |
from torchvision.transforms import transforms
|
7 |
import gradio as gr
|
8 |
|
9 |
-
parser = argparse.ArgumentParser(description="Image Classification")
|
10 |
-
parser.add_argument("-i", "--image_path", required=True, help="Path to the image file")
|
11 |
-
args = parser.parse_args()
|
12 |
|
13 |
model = torch.load('model.pth', map_location=torch.device('cpu'))
|
14 |
model.eval()
|
@@ -57,7 +53,7 @@ def create_tags(image):
|
|
57 |
|
58 |
demo = gr.Interface(
|
59 |
fn=create_tags,
|
60 |
-
inputs=["
|
61 |
outputs=["text"],
|
62 |
)
|
63 |
demo.launch()
|
|
|
|
|
1 |
import json
|
2 |
import time
|
3 |
from PIL import Image
|
|
|
5 |
from torchvision.transforms import transforms
|
6 |
import gradio as gr
|
7 |
|
|
|
|
|
|
|
8 |
|
9 |
model = torch.load('model.pth', map_location=torch.device('cpu'))
|
10 |
model.eval()
|
|
|
53 |
|
54 |
demo = gr.Interface(
|
55 |
fn=create_tags,
|
56 |
+
inputs=[gr.Image(type="pil")],
|
57 |
outputs=["text"],
|
58 |
)
|
59 |
demo.launch()
|