python 对接阿里通义万象文生图

通义万相是阿里云“通义”大模型系列第三个产品,此前的通义千问、通义听悟分别具备文字问答和语音文字处理的功能。

第一步:获取API Key

第二步:安装SDK

/www/wwwroot/Python/myenv/bin/pip3 install -U openai

第三步:模型调用

项目源码:

\www\wwwroot\Python\wenshengtu\tongyiwanxiang.py

from http import HTTPStatus
from urllib.parse import urlparse, unquote
from pathlib import PurePosixPath
from dashscope import ImageSynthesis
from datetime import datetime
from flask import Flask, request, render_template
import os,requests,pymysql
app = Flask(__name__)
@app.route('/tongyiwanxiang')
def tongyiwanxiang():
    return render_template('tongyiwanxiang.html')
@app.route('/get_data', methods=['POST'])
def get_data():
    # 从POST请求中获取名为'param'的参数
    prompt = request.form.get('prompt')
    number = request.form.get('number',1)
    style =  request.form.get('style','<watercolor>')
    size = request.form.get('size','1280*720')
    # 对参数进行处理
    processed_param = process_param(prompt,number,style,size)
    return processed_param
def process_param(prompt,number,style,size):
    print('----sync call, please wait a moment----')
    # print(prompt+number+style+size)
    # 连接数据库
    conn = pymysql.connect(host='localhost', user='xxx', password='xxx', database='xxx')
    # 创建游标
    cursor = conn.cursor() 
    # 获取当前时间
    created_at=datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    # 执行SQL语句 新增数据 并返回影响行数
    sql1='INSERT INTO imglist(numberx, sizex, style, prompt,created_at) VALUES ("'+number+'", '+size+', "'+style+'", "'+prompt+'", "'+created_at+'")'  
    rows = cursor.execute(sql1)
    # 手动提交
    conn.commit()
    # 获取最新自增ID
    inserted_id = cursor.lastrowid
    number=int(number)
    rsp = ImageSynthesis.call(api_key="sk-xxx",
                              model=ImageSynthesis.Models.wanx_v1,
                              prompt=prompt,
                              n=number,
                              style=style,
                              seed=1234,
                              size=size)
    res=rsp['output']['results']
    imgurl=""
    for k, r in  enumerate(res):
        if k==0:
            imgurl=r['url']
        else:
            imgurl=imgurl+","+r['url']
    sql2='UPDATE imglist SET imgurl="'+imgurl+'" WHERE id='+str(inserted_id);
    rows = cursor.execute(sql2)
    # 手动提交
    conn.commit()
    # 关闭游标和连接
    cursor.close()
    conn.close()
    rsp['okid']=inserted_id
    return rsp                          
    # print('response: %s' % rsp)
    # if rsp.status_code == HTTPStatus.OK:
    #     # 在当前目录下保存图片
    #     for result in rsp.output.results:
    #         file_name = PurePosixPath(unquote(urlparse(result.url).path)).parts[-1]
    #         with open('./%s' % file_name, 'wb+') as f:
    #             f.write(requests.get(result.url).content)
    # else:
    #     print('sync_call Failed, status_code: %s, code: %s, message: %s' %
    #           (rsp.status_code, rsp.code, rsp.message))
if __name__ == '__main__':
    app.run(debug=True)

www\wwwroot\Python\wenshengtu\templates\tongyiwanxiang.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Flask Frontend</title>
    <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/tongyiwanxiang.css') }}">
    
</head>
<body>
<center>
 <div class="ConfigSection__config-section--NURK8">
     <div class="ConfigSection__main-content--jq57_"><div class="PredictConfigArea__predict-config-area--z2hA3 ConfigSection__predict-config-area-view--GfIhm"><div class="PredictConfigArea__top-bar--g8fS3"><div class="ConfigSection__title-wrap--l_ugN"><i class="bl-iconfont bl-icon-config-line ConfigSection__config-icon--RCGiC efm-bl-icon"></i>
     <label class="CustomTitle__title--hheOx ConfigSection__title--XhBsp">文生图</label></div>
     
     <div class="PredictConfigArea__top-right-content--kjgOT"><i class="bl-iconfont bl-icon-clear-line efm-bl-cursor-pointer PredictConfigArea__action-icon--Y1JoT efm_ai-ml8 efm-bl-icon"></i><a target="_blank" href="https://look.zlhdsg.com/index/index/wenshengtu.html">历史列表</a></div>
     
     </div><form class="efm_ant-form efm_ant-form-horizontal css-o1mf1m PredictConfigFields__predict-config-fields--NqKKR PredictConfigArea__predict-config-fields-view--zsPnI efm-bl-form"><div style="display: block;"><div class="TextAreaField__field-container--Ip8Ve"><div class="efm_ant-form-item TextAreaField__custom-field--_nvw3 css-o1mf1m"><div class="efm_ant-row efm_ant-form-item-row css-o1mf1m"><div class="efm_ant-col efm_ant-form-item-label css-o1mf1m" style="flex: unset;"><label for="prompt" class="efm_ant-form-item-required efm_ant-form-item-required-mark-optional" title="正向Prompt">正向提示词<span class="efm-bl-required-mark">*</span></label></div><div class="efm_ant-col efm_ant-col-24 efm_ant-form-item-control css-o1mf1m"><div class="efm_ant-form-item-control-input"><div class="efm_ant-form-item-control-input-content"><span class="efm_ant-input-affix-wrapper efm_ant-input-textarea-affix-wrapper efm_ant-input-textarea-show-count css-o1mf1m efm_ant-input-show-count efm_ant-input-outlined" data-count="0 / 2000" style="height: auto;">
         <textarea placeholder="请输入如:一位年轻的中国女人,牛仔裤,米白色长袖T恤,完美无瑕,干净,黑发,身材匀称,25岁,完美的女性身体,细腰,背对着镜头,站立着,上半身俯趴在桌子上,弓起身子,撅起屁股,紧致的粗大腿,后视非常迷人,背对着,镜头距离10米 ,全身照,全身生活彩照, 真实拍摄,美颜相机,超真实相片,美美的妆造,光影感,背光,光滑的皮肤。" id="prompt" aria-required="true" maxlength="2000" class="efm_ant-input css-o1mf1m" style="overflow-y: hidden; resize: none; height: 74px; min-height: 74px; max-height: 140px;width:100%"></textarea>
         <span class="efm_ant-input-suffix"><span class="efm_ant-input-data-count">0 / 2000</span></span></span></div></div></div></div></div></div></div>

 
 <div style="display: block;"><div class="efm_ant-form-item css-o1mf1m efm_ant-form-item-has-success"><div class="efm_ant-row efm_ant-form-item-row css-o1mf1m"><div class="efm_ant-col efm_ant-form-item-label css-o1mf1m" style="flex: unset;"><label for="modelParam_style" class="efm_ant-form-item-required efm_ant-form-item-required-mark-optional" title="style">style<span class="blicon blicon-helpCircle-line efm_ant-form-item-tooltip" title="" role="img" aria-label="helpCircle-line"><svg width="1em" height="1em" viewBox="0 0 1024 1024" overflow="hidden" fill="currentColor" aria-hidden="true"><path d="M938.666667 512c0 235.648-191.018667 426.666667-426.666667 426.666667S85.333333 747.648 85.333333 512 276.352 85.333333 512 85.333333s426.666667 191.018667 426.666667 426.666667z m-64 0a362.666667 362.666667 0 1 0-725.333334 0 362.666667 362.666667 0 0 0 725.333334 0z m-362.624-184.021333c-52.906667 0-96 35.925333-96 80.042666a29.781333 29.781333 0 0 1-29.824 29.781334H381.866667a29.824 29.824 0 0 1-29.824-29.781334c0-39.338667 17.194667-76.032 48.426666-103.338666 29.994667-26.197333 69.546667-40.704 111.573334-40.704 42.026667 0 81.621333 14.421333 111.616 40.704 31.189333 27.306667 48.384 64 48.298666 103.296 0 57.813333-38.101333 109.824-97.109333 132.522666a48.298667 48.298667 0 0 0-30.890667 44.8v3.157334a32 32 0 0 1-64 0v-1.962667a111.786667 111.786667 0 0 1 72.021334-105.813333c34.090667-13.098667 56.064-41.6 56.064-72.704 0-44.074667-43.093333-79.957333-96-79.957334z m-28.288 420.266666a39.978667 39.978667 0 1 1 56.576-56.533333 39.978667 39.978667 0 0 1-56.576 56.576z"></path></svg></span><span class="efm-bl-required-mark">*</span></label></div><div class="efm_ant-col efm_ant-col-24 efm_ant-form-item-control css-o1mf1m"><div class="efm_ant-form-item-control-input"><div class="efm_ant-form-item-control-input-content"><div class="efm_ant-row css-o1mf1m" style="margin-left: -3px; margin-right: -3px; row-gap: 6px;display: flex;flex-flow: row wrap;min-width: 0;">
     
        <div class="efm_ant-col efm_ant-col-8 css-o1mf1m" style="padding-left: 3px; padding-right: 3px;">
         <div class="ImageButtonRadioOption__button-radio-option--ivPSQ ImageButtonRadioOption__image-radio-option--GQW8V ImageButtonRadioOption__checked--Es7ax" value="<auto>" style="background: linear-gradient(0deg, rgba(38, 36, 76, 0.4), rgba(38, 36, 76, 0.4)), url(&quot;https://img.alicdn.com/imgextra/i2/O1CN011O63Nx1kGxP0iWziu_!!6000000004657-0-tps-600-595.jpg&quot;) center center / 100% no-repeat;"><div class="ImageButtonRadioOption__label--Fh_s3">默认</div><div class="ImageButtonRadioOption__value--o9x9J">"auto"</div></div></div>
         <div class="efm_ant-col efm_ant-col-8 css-o1mf1m" style="padding-left: 3px; padding-right: 3px;"><div class="ImageButtonRadioOption__button-radio-option--ivPSQ ImageButtonRadioOption__image-radio-option--GQW8V" value="<3d cartoon>" style="background: linear-gradient(0deg, rgba(38, 36, 76, 0.4), rgba(38, 36, 76, 0.4)), url(&quot;https://img.alicdn.com/imgextra/i4/O1CN01hskruP1KcJreu8a22_!!6000000001184-0-tps-600-595.jpg&quot;) center center / 100% no-repeat;"><div class="ImageButtonRadioOption__label--Fh_s3">3D卡通</div><div class="ImageButtonRadioOption__value--o9x9J">"3d cartoon"</div></div></div>
         <div class="efm_ant-col efm_ant-col-8 css-o1mf1m" style="padding-left: 3px; padding-right: 3px;"><div class="ImageButtonRadioOption__button-radio-option--ivPSQ ImageButtonRadioOption__image-radio-option--GQW8V" value="<anime>"  style="background: linear-gradient(0deg, rgba(38, 36, 76, 0.4), rgba(38, 36, 76, 0.4)), url(&quot;https://img.alicdn.com/imgextra/i2/O1CN01r0BnOq1mYTmrqtDp0_!!6000000004966-0-tps-600-595.jpg&quot;) center center / 100% no-repeat;"><div class="ImageButtonRadioOption__label--Fh_s3">动画</div><div class="ImageButtonRadioOption__value--o9x9J">"anime"</div></div></div>
         <div class="efm_ant-col efm_ant-col-8 css-o1mf1m" style="padding-left: 3px; padding-right: 3px;"><div class="ImageButtonRadioOption__button-radio-option--ivPSQ ImageButtonRadioOption__image-radio-option--GQW8V" value="<oil painting>" style="background: linear-gradient(0deg, rgba(38, 36, 76, 0.4), rgba(38, 36, 76, 0.4)), url(&quot;https://img.alicdn.com/imgextra/i1/O1CN01pWQ0lK1dgsVWjphQn_!!6000000003766-0-tps-600-595.jpg&quot;) center center / 100% no-repeat;"><div class="ImageButtonRadioOption__label--Fh_s3">油画</div><div class="ImageButtonRadioOption__value--o9x9J">"oil painting"</div></div></div>
         <div class="efm_ant-col efm_ant-col-8 css-o1mf1m" style="padding-left: 3px; padding-right: 3px;"><div class="ImageButtonRadioOption__button-radio-option--ivPSQ ImageButtonRadioOption__image-radio-option--GQW8V" value="<watercolor>" style="background: linear-gradient(0deg, rgba(38, 36, 76, 0.4), rgba(38, 36, 76, 0.4)), url(&quot;https://img.alicdn.com/imgextra/i3/O1CN01I76QDg1kJhmKTCWUu_!!6000000004663-0-tps-600-595.jpg&quot;) center center / 100% no-repeat;"><div class="ImageButtonRadioOption__label--Fh_s3">水彩</div><div class="ImageButtonRadioOption__value--o9x9J">"watercolor"</div></div></div>
         <div class="efm_ant-col efm_ant-col-8 css-o1mf1m" style="padding-left: 3px; padding-right: 3px;"><div class="ImageButtonRadioOption__button-radio-option--ivPSQ ImageButtonRadioOption__image-radio-option--GQW8V" value="<sketch>" style="background: linear-gradient(0deg, rgba(38, 36, 76, 0.4), rgba(38, 36, 76, 0.4)), url(&quot;https://img.alicdn.com/imgextra/i2/O1CN0152hIXE1g0gs6wSXCo_!!6000000004080-0-tps-600-595.jpg&quot;) center center / 100% no-repeat;"><div class="ImageButtonRadioOption__label--Fh_s3">素描</div><div class="ImageButtonRadioOption__value--o9x9J">"sketch"</div></div></div>
         <div class="efm_ant-col efm_ant-col-8 css-o1mf1m" style="padding-left: 3px; padding-right: 3px;"><div class="ImageButtonRadioOption__button-radio-option--ivPSQ ImageButtonRadioOption__image-radio-option--GQW8V" value="<chinese painting>" style="background: linear-gradient(0deg, rgba(38, 36, 76, 0.4), rgba(38, 36, 76, 0.4)), url(&quot;https://img.alicdn.com/imgextra/i3/O1CN01JZYQ4h20ZlWH7WjSp_!!6000000006864-0-tps-600-595.jpg&quot;) center center / 100% no-repeat;"><div class="ImageButtonRadioOption__label--Fh_s3">中国画</div><div class="ImageButtonRadioOption__value--o9x9J">"chinese painting"</div></div></div>
         <div class="efm_ant-col efm_ant-col-8 css-o1mf1m" style="padding-left: 3px; padding-right: 3px;"><div class="ImageButtonRadioOption__button-radio-option--ivPSQ ImageButtonRadioOption__image-radio-option--GQW8V" value="<flat illustration>" style="background: linear-gradient(0deg, rgba(38, 36, 76, 0.4), rgba(38, 36, 76, 0.4)), url(&quot;https://img.alicdn.com/imgextra/i2/O1CN01DWkQJk1SVSrbGSlsN_!!6000000002252-0-tps-600-595.jpg&quot;) center center / 100% no-repeat;"><div class="ImageButtonRadioOption__label--Fh_s3">扁平插画</div><div class="ImageButtonRadioOption__value--o9x9J">"flat illustration"</div></div></div>
         
         </div></div></div></div></div></div></div>
 
 <div style="display: block;"><div class="efm_ant-form-item css-o1mf1m efm_ant-form-item-has-success"><div class="efm_ant-row efm_ant-form-item-row css-o1mf1m"><div class="efm_ant-col efm_ant-form-item-label css-o1mf1m" style="flex: unset;"><label for="modelParam_size" class="efm_ant-form-item-required efm_ant-form-item-required-mark-optional" title="size">size<span class="blicon blicon-helpCircle-line efm_ant-form-item-tooltip" title="" role="img" aria-label="helpCircle-line"><svg width="1em" height="1em" viewBox="0 0 1024 1024" overflow="hidden" fill="currentColor" aria-hidden="true"><path d="M938.666667 512c0 235.648-191.018667 426.666667-426.666667 426.666667S85.333333 747.648 85.333333 512 276.352 85.333333 512 85.333333s426.666667 191.018667 426.666667 426.666667z m-64 0a362.666667 362.666667 0 1 0-725.333334 0 362.666667 362.666667 0 0 0 725.333334 0z m-362.624-184.021333c-52.906667 0-96 35.925333-96 80.042666a29.781333 29.781333 0 0 1-29.824 29.781334H381.866667a29.824 29.824 0 0 1-29.824-29.781334c0-39.338667 17.194667-76.032 48.426666-103.338666 29.994667-26.197333 69.546667-40.704 111.573334-40.704 42.026667 0 81.621333 14.421333 111.616 40.704 31.189333 27.306667 48.384 64 48.298666 103.296 0 57.813333-38.101333 109.824-97.109333 132.522666a48.298667 48.298667 0 0 0-30.890667 44.8v3.157334a32 32 0 0 1-64 0v-1.962667a111.786667 111.786667 0 0 1 72.021334-105.813333c34.090667-13.098667 56.064-41.6 56.064-72.704 0-44.074667-43.093333-79.957333-96-79.957334z m-28.288 420.266666a39.978667 39.978667 0 1 1 56.576-56.533333 39.978667 39.978667 0 0 1-56.576 56.576z"></path></svg></span><span class="efm-bl-required-mark">*</span></label></div><div class="efm_ant-col efm_ant-col-24 efm_ant-form-item-control css-o1mf1m"><div class="efm_ant-form-item-control-input"><div class="efm_ant-form-item-control-input-content"><div class="efm_ant-row css-o1mf1m" style="margin-left: -3px; margin-right: -3px; row-gap: 6px;">
     
     <div class="efm_ant-col css-o1mf1m" style="padding-left: 3px; padding-right: 3px; flex: 0 0 auto;"><div class="SizeButtonRadioOption__button-radio-option--bl510 SizeButtonRadioOption__size-button-radio-option--d7ukt SizeButtonRadioOption__checked--OBygU" value="1024*1024"><span class="SizeButtonRadioOption__rect--zNXkV" style="width: 15px; height: 15px;"></span>1024*1024</div></div>
     <div class="efm_ant-col css-o1mf1m" style="padding-left: 3px; padding-right: 3px; flex: 0 0 auto;"><div class="SizeButtonRadioOption__button-radio-option--bl510 SizeButtonRadioOption__size-button-radio-option--d7ukt" value="768*1152"><span class="SizeButtonRadioOption__rect--zNXkV" style="width: 15px; height: 20px;"></span>768*1152</div></div>
     <div class="efm_ant-col css-o1mf1m" style="padding-left: 3px; padding-right: 3px; flex: 0 0 auto;"><div class="SizeButtonRadioOption__button-radio-option--bl510 SizeButtonRadioOption__size-button-radio-option--d7ukt" value="720*1280"><span class="SizeButtonRadioOption__rect--zNXkV" style="width: 15px; height: 21px;"></span>720*1280</div></div>
     <div class="efm_ant-col css-o1mf1m" style="padding-left: 3px; padding-right: 3px; flex: 0 0 auto;"><div class="SizeButtonRadioOption__button-radio-option--bl510 SizeButtonRadioOption__size-button-radio-option--d7ukt"  value="1280*720"><span class="SizeButtonRadioOption__rect--zNXkV" style="width: 21px; height: 15px;"></span>1280*720</div></div>
     
     </div></div></div></div></div></div></div>
 
 
 <div style="display: block;"><div class="efm_ant-form-item css-o1mf1m efm_ant-form-item-has-success"><div class="efm_ant-row efm_ant-form-item-row css-o1mf1m"><div class="efm_ant-col efm_ant-form-item-label css-o1mf1m" style="flex: unset;"><label for="modelParam_n" class="efm_ant-form-item-required efm_ant-form-item-required-mark-optional" title="n">number<span class="blicon blicon-helpCircle-line efm_ant-form-item-tooltip" title="" role="img" aria-label="helpCircle-line"></span><span class="efm-bl-required-mark">*</span></label></div><div class="efm_ant-col efm_ant-col-24 efm_ant-form-item-control css-o1mf1m"><div class="efm_ant-form-item-control-input"><div class="efm_ant-form-item-control-input-content"><div class="efm_ant-row css-o1mf1m" style="margin-left: -3px; margin-right: -3px; row-gap: 6px;">
     
     <div class="efm_ant-col css-o1mf1m" style="padding-left: 3px; padding-right: 3px; flex: 0 0 auto;"><div class="DefaultButtonRadioOption__button-radio-option--Hi5pL DefaultButtonRadioOption__checked--pDQ4z" value="1">1张</div></div>
     <div class="efm_ant-col css-o1mf1m" style="padding-left: 3px; padding-right: 3px; flex: 0 0 auto;"><div class="DefaultButtonRadioOption__button-radio-option--Hi5pL" value="2">2张</div></div>
     <div class="efm_ant-col css-o1mf1m" style="padding-left: 3px; padding-right: 3px; flex: 0 0 auto;"><div class="DefaultButtonRadioOption__button-radio-option--Hi5pL" value="3">3张</div></div>
     <div class="efm_ant-col css-o1mf1m" style="padding-left: 3px; padding-right: 3px; flex: 0 0 auto;"><div class="DefaultButtonRadioOption__button-radio-option--Hi5pL" value="4">4张</div></div>
     
     </div></div></div></div></div></div></div>

     </form></div>
     
     </div><button type="button" class="efm_ant-btn css-o1mf1m efm_ant-btn-primary efm_ant-btn-lg efm_ai-mt4" style="height:35px !important
;cursor: not-allowed;color: #c3c4d5;background:rgba(239, 239, 239, 0.3);box-shadow: none;border: none;" disabled=""><span class="detailxx">开始生成</span></button>
<br>
<a class="wmk" style="display:none;" href="javascript:;"><div class="efm_ant-btn css-o1mf1m  efm_ant-btn-lg zxcv" style="height:35px !important
;cursor: not-allowed;color: #c3c4d5;background:rgba(239, 239, 239, 0.3);box-shadow: none;border: none;" disabled=""><span class="detailx"      style="line-height: 34px;font-size: 14px;">点击查看</span></div></a>


</div>

     </center>   
<script>
    $(document).ready(function() {
        $('.ImageButtonRadioOption__image-radio-option--GQW8V').click(function(){
            $('.ImageButtonRadioOption__image-radio-option--GQW8V').removeClass('ImageButtonRadioOption__checked--Es7ax');
            $(this).addClass('ImageButtonRadioOption__checked--Es7ax');
            check();
        })
        $('.SizeButtonRadioOption__size-button-radio-option--d7ukt').click(function(){
            $('.SizeButtonRadioOption__size-button-radio-option--d7ukt').removeClass('SizeButtonRadioOption__checked--OBygU');
            $(this).addClass('SizeButtonRadioOption__checked--OBygU');
            check();
        })
        $('.DefaultButtonRadioOption__button-radio-option--Hi5pL').click(function(){
            $('.DefaultButtonRadioOption__button-radio-option--Hi5pL').removeClass('DefaultButtonRadioOption__checked--pDQ4z');
            $(this).addClass('DefaultButtonRadioOption__checked--pDQ4z');
            check();
        });
        $('.efm_ant-input').bind('input propertychange', function() {
            areat=$(this).val();
            $(".efm_ant-input-data-count").text(areat.length+" / 2000");
            if(areat.length<1){
                $(".efm_ai-mt4").attr('disabled','disabled');
                $(".efm_ant-btn-primary").css('cursor','not-allowed');
                $(".efm_ant-btn-primary").css('color','#c3c4d5');
                $(".efm_ant-btn-primary").css('background','rgba(239, 239, 239, 0.3)');
                
            }
            check();
        });
        function check(){
            prompt=$(".efm_ant-input").val();
            if(prompt){
                
                $(".efm_ant-btn-primary").css('cursor','pointer');
                $(".efm_ant-btn-primary").css('color','#fff');
                $(".efm_ant-btn-primary").css('background','rgb(98, 74, 255)');
                $(".efm_ai-mt4").removeAttr('disabled');
            }
        }
        
        $(".efm_ai-mt4").click(function(){
            prompt=$(".efm_ant-input").val();
            number=$(".DefaultButtonRadioOption__checked--pDQ4z").attr('value');
            style=$(".ImageButtonRadioOption__checked--Es7ax").attr('value');
            size=$(".SizeButtonRadioOption__checked--OBygU").attr('value');
            $(this).attr('disabled','disabled');
            $(".efm_ant-btn-primary").css('background','rgb(98, 74, 255,0.3)');
            $('.detailxx').text('正在生成');
            $('.wmk').css('display','none');
            $(".efm_ant-btn-primary").css('cursor','not-allowed');
            sendali(prompt,number,style,size);
        })
        function sendali(prompt,number,style,size){
            data={
                    'prompt':prompt,
                    'number':number,
                    'style':style,
                    'size':size
                };
            console.log(data);    
            $.ajax({
                url: '/get_data',
                type: 'post',
                data:data,
                dataType: 'json',
                success: function(data) {
                    console.log(data);
                    // 处理返回的数据
                    $('.wmk').attr('href','https://look.zlhdsg.com/index/index/wenshengtudetail?id='+data.okid);
                    $('.wmk').attr('target','_blank');
                    $(".zxcv").css('cursor','pointer');
                    $(".zxcv").css('color','#fff');
                    $(".zxcv").css('background','rgb(98, 74, 255)');
                    $(".efm_ai-mt4").removeAttr('disabled');
                    $(".efm_ant-btn-primary").css('background','rgb(98, 74, 255)');
                    $(".efm_ant-btn-primary").css('cursor','pointer');
                     $('.detailxx').text('开始生成');
                    $('.wmk').css('display','block');
                },
                error: function(error) {
                    console.error(error);
                }
            });
        }
        
    });
</script>
 
</body>
</html>

www\wwwroot\Python\wenshengtu\static\css\tongyiwanxiang.css

成品项目