Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,7 @@ model.eval()
|
|
| 13 |
def get_tags(image, threshold, top_k):
|
| 14 |
current_datetime = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
|
| 15 |
print(f"{current_datetime}: started.")
|
| 16 |
-
results = tagger.predict(
|
| 17 |
temp = []
|
| 18 |
return_dict = dict()
|
| 19 |
for rank, (tag, score) in enumerate(results, 1):
|
|
@@ -27,7 +27,7 @@ def get_tags(image, threshold, top_k):
|
|
| 27 |
demo = gr.Interface(
|
| 28 |
get_tags,
|
| 29 |
inputs=[
|
| 30 |
-
gr.Image(label="Source", sources=['upload',], type='
|
| 31 |
gr.Slider(minimum=0.00, maximum=1.00, step=0.01, value=0.30, label="Threshold"),
|
| 32 |
gr.Slider(minimum=0, maximum=500, step=1, value=30, label="Top K")
|
| 33 |
],
|
|
|
|
| 13 |
def get_tags(image, threshold, top_k):
|
| 14 |
current_datetime = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
|
| 15 |
print(f"{current_datetime}: started.")
|
| 16 |
+
results = tagger.predict(image, topk=top_k, threshold=threshold)
|
| 17 |
temp = []
|
| 18 |
return_dict = dict()
|
| 19 |
for rank, (tag, score) in enumerate(results, 1):
|
|
|
|
| 27 |
demo = gr.Interface(
|
| 28 |
get_tags,
|
| 29 |
inputs=[
|
| 30 |
+
gr.Image(label="Source", sources=['upload',], type='filepath'),
|
| 31 |
gr.Slider(minimum=0.00, maximum=1.00, step=0.01, value=0.30, label="Threshold"),
|
| 32 |
gr.Slider(minimum=0, maximum=500, step=1, value=30, label="Top K")
|
| 33 |
],
|