File size: 850 Bytes
b948a08
c2b4d5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c9a11d0
 
c2b4d5f
 
404baf7
f418104
 
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
import os
from flask import Flask, request, jsonify
from gradio_client import Client

app = Flask(__name__)

@app.route('/', methods=['GET'])
def get_prediction():

    # Extract data for prediction
    prompt = request.args.get("prompt")
    negative_prompt = request.args.get("negative_prompt")
    width = int(request.args.get("width"))
    height = int(request.args.get("height"))

    # Make prediction using Gradio Client
    client = Client("https://ddosxd-realvisxl.hf.space/--replicas/flm7z/")
    result = client.predict(
        prompt,
        negative_prompt,
        True,
        0,
        width,
        height,
        7,
        True,
        api_name="/run"
    )

    # Return the result as JSON response
    return jsonify(result)

if __name__ == '__main__':
    app.run(host='0.0.0.0',  port=int(os.environ.get('PORT', 7860)))