Spaces:
Runtime error
Runtime error
File size: 1,562 Bytes
8dc3fdd c0bed6d ef7e565 8dc3fdd c0bed6d 9047378 8dc3fdd 7b9ae35 6ea49db c0bed6d 8dc3fdd c0bed6d 8dc3fdd |
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
from flask import Flask, request, jsonify
from gradio_client import Client
import gradio as gr
app = Flask(__name__)
client = Client("radames/Enhance-This-HiDiffusion-SDXL")
@app.route('/predict', methods=['POST'])
def my_interface():
data = request.get_json()
input_image = data['input_image']
prompt = data.get('prompt', "This is a beautiful scenery")
negative_prompt = data.get('negative_prompt', "blurry, ugly, duplicate, poorly drawn, deformed, mosaic")
seed = data.get('seed', 1415926535897932)
guidance_scale = data.get('guidance_scale', 8.5)
scale = data.get('scale', 2)
controlnet_conditioning_scale = data.get('controlnet_conditioning_scale', 0.5)
strength = data.get('strength', 1.0)
controlnet_start = data.get('controlnet_start', 0.0)
controlnet_end = data.get('controlnet_end', 1.0)
guassian_sigma = data.get('guassian_sigma', 2.0)
intensity_threshold = data.get('intensity_threshold', 3)
result = client.predict(
input_image=input_image,
prompt=prompt,
negative_prompt=negative_prompt,
seed=seed,
guidance_scale=guidance_scale,
scale=scale,
controlnet_conditioning_scale=controlnet_conditioning_scale,
strength=strength,
controlnet_start=controlnet_start,
controlnet_end=controlnet_end,
guassian_sigma=guassian_sigma,
intensity_threshold=intensity_threshold,
api_name="/predict"
)
return jsonify(result[0][0])
if __name__ == '__main__':
app.run(debug=True) |