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 | |
def home(): | |
return 'Image Upscaling App' | |
# Define the route for the image upscaling | |
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() | |