File size: 652 Bytes
157f1bb
5e43fe5
d306302
5e43fe5
b38ae85
5e43fe5
 
d306302
5e43fe5
 
 
 
d306302
5e43fe5
 
 
 
 
157f1bb
5e43fe5
 
157f1bb
5e43fe5
 
d306302
5e43fe5
 
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 transformers import pipeline
from flask import Flask, request, jsonify

app = Flask(__name__)

# Create the pipeline for image upscaling
upscaler = pipeline("image-upscaling", model="deepset/electricity-converter-0036")

# Define the route for the home page
@app.route('/')
def home():
    return 'Image Upscaling App'

# Define the route for the image upscaling
@app.route('/upscale', methods=['POST'])
def upscale():
    # Get the uploaded image
    file = request.files['file']

    # Upscale the image
    output = upscaler(file)

    # Return the upscaled image
    return jsonify({'image': output})

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