import torch


model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
img = 'https://ultralytics.com/images/zidane.jpg'
results = model(img)

import json

with open('tags_ko.json') as f:
    tags_ko = json.load(f)
    
from glob import glob

img_list = glob('static/photos/*.jpg')

db = {}

for img_path in img_list:
    results = model(img_path)
    
    tags = set()

    for pred in results.pred[0]:
        tag = results.names[int(pred[-1])] # English
#         tag = tags_ko[int(pred[-1])] # Korean
        tag = tag.replace(' ', '')
        tags.add(tag)
        
    db[img_path] = list(tags)


from flask import Flask, render_template

app = Flask(__name__)

@app.route('/')
def index():
    return render_template('templates/index.html', photos=db)

if __name__ == '__main__':
    app.run()
05042a0df9ad09955ecc8cb088fceb768895bfb0
<mask token>


@app.route('/')
def index():
    return render_template('templates/index.html', photos=db)


<mask token>

<mask token>
with open('tags_ko.json') as f:
    tags_ko = json.load(f)
<mask token>
for img_path in img_list:
    results = model(img_path)
    tags = set()
    for pred in results.pred[0]:
        tag = results.names[int(pred[-1])]
        tag = tag.replace(' ', '')
        tags.add(tag)
    db[img_path] = list(tags)
<mask token>


@app.route('/')
def index():
    return render_template('templates/index.html', photos=db)


if __name__ == '__main__':
    app.run()

<mask token>
model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
img = 'https://ultralytics.com/images/zidane.jpg'
results = model(img)
<mask token>
with open('tags_ko.json') as f:
    tags_ko = json.load(f)
<mask token>
img_list = glob('static/photos/*.jpg')
db = {}
for img_path in img_list:
    results = model(img_path)
    tags = set()
    for pred in results.pred[0]:
        tag = results.names[int(pred[-1])]
        tag = tag.replace(' ', '')
        tags.add(tag)
    db[img_path] = list(tags)
<mask token>
app = Flask(__name__)


@app.route('/')
def index():
    return render_template('templates/index.html', photos=db)


if __name__ == '__main__':
    app.run()

import torch
model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
img = 'https://ultralytics.com/images/zidane.jpg'
results = model(img)
import json
with open('tags_ko.json') as f:
    tags_ko = json.load(f)
from glob import glob
img_list = glob('static/photos/*.jpg')
db = {}
for img_path in img_list:
    results = model(img_path)
    tags = set()
    for pred in results.pred[0]:
        tag = results.names[int(pred[-1])]
        tag = tag.replace(' ', '')
        tags.add(tag)
    db[img_path] = list(tags)
from flask import Flask, render_template
app = Flask(__name__)


@app.route('/')
def index():
    return render_template('templates/index.html', photos=db)


if __name__ == '__main__':
    app.run()

import torch


model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
img = 'https://ultralytics.com/images/zidane.jpg'
results = model(img)

import json

with open('tags_ko.json') as f:
    tags_ko = json.load(f)
    
from glob import glob

img_list = glob('static/photos/*.jpg')

db = {}

for img_path in img_list:
    results = model(img_path)
    
    tags = set()

    for pred in results.pred[0]:
        tag = results.names[int(pred[-1])] # English
#         tag = tags_ko[int(pred[-1])] # Korean
        tag = tag.replace(' ', '')
        tags.add(tag)
        
    db[img_path] = list(tags)


from flask import Flask, render_template

app = Flask(__name__)

@app.route('/')
def index():
    return render_template('templates/index.html', photos=db)

if __name__ == '__main__':
    app.run()