File size: 607 Bytes
bc19da9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from flask import Flask, render_template, redirect, request

import Caption_it1

app=Flask(__name__)

@app.route('/')
def hello():
    return render_template('index.html')

@app.route('/',methods=['POST'])
def marks():
    if request.method=='POST':
        f=request.files['userfile']
        path='static/{}'.format(f.filename)
        f.save(path)

        caption=Caption_it1.caption_this_image(path)

        result_dic={
            'image':path,
            'caption':caption
        }

    return render_template('index.html',your_result=result_dic)

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