main
黄海 12 months ago
parent 95ca50e3a5
commit 7667004290

@ -3,5 +3,5 @@
<component name="Black"> <component name="Black">
<option name="sdkName" value="Python 3.11 (venv)" /> <option name="sdkName" value="Python 3.11 (venv)" />
</component> </component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (py310)" project-jdk-type="Python SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (BaiHu)" project-jdk-type="Python SDK" />
</project> </project>

@ -2,7 +2,7 @@
<module type="PYTHON_MODULE" version="4"> <module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" /> <content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.10 (py310)" jdkType="Python SDK" /> <orderEntry type="jdk" jdkName="Python 3.10 (BaiHu)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </module>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 608 KiB

@ -212,9 +212,10 @@ def restart_server(webui_address):
# 清理一下SD # 清理一下SD
def release_sd(webui_address, comfyui_address): def release_sd(webui_address, comfyui_address):
pass
# comfyui的显存先清理一下 # comfyui的显存先清理一下
clear_comfyui_cache(comfyui_address) # clear_comfyui_cache(comfyui_address)
# 文生图一下据测试在img_2_img报错暴显存的时候需要先清一下显存 # 文生图一下据测试在img_2_img报错暴显存的时候需要先清一下显存
txt_2_img_blank(webui_address) # txt_2_img_blank(webui_address)
# 清理一下缓存 # 清理一下缓存
clear_webui_cache(webui_address) # clear_webui_cache(webui_address)

@ -32,9 +32,6 @@ def webui_txt_2_img(model_id, json_data, input_image, target_folder):
# 图片 # 图片
args = json_data['alwayson_scripts']['ControlNet']['args'] args = json_data['alwayson_scripts']['ControlNet']['args']
# pretty_json = json.dumps(json_data, indent=4,ensure_ascii=False)
# print(pretty_json)
pose_image = json_data['pose_image'] pose_image = json_data['pose_image']
args[0]['input_image'] = encode_image(input_image[0]) args[0]['input_image'] = encode_image(input_image[0])
# 如果有特殊的姿态要求,那就用模板指定的姿态图 # 如果有特殊的姿态要求,那就用模板指定的姿态图
@ -88,6 +85,7 @@ def webui_img_2_img(model_id, prompt_id, json_data, input_image, target_folder):
printf("开始生成图片...") printf("开始生成图片...")
# 调用生图服务 # 调用生图服务
response = submit_post(img2img_url, json_data) response = submit_post(img2img_url, json_data)
#print(response.text)
# 创建文件的完整路径 # 创建文件的完整路径
file_path = os.path.join(target_folder, str(uuid.uuid4()) + '.png') file_path = os.path.join(target_folder, str(uuid.uuid4()) + '.png')
save_encoded_image(response.json()['images'][0], file_path) save_encoded_image(response.json()['images'][0], file_path)

@ -1,12 +0,0 @@
Copyright 2014-2021 Amyuni Technologies Inc.
https://www.amyuni.com
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
By using this software, you accept to be prompted with an advertisement page which is not always under the control of the author. A fully commercial version is available for users who do not wisth to see those advertisements.
Permission is granted to anyone to use this software for any purpose subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment in the product documentation would be required.
2. Altered versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any distribution.

@ -1,50 +0,0 @@
Procedure to add a virtual monitor to your system (Windows 10 Only!)
- Download our virtual display driver from https://www.amyuni.com/downloads/usbmmidd_v2.zip
- Unpack the zip file to an empty folder, e.g. c:\temp\usbmmidd
- Make sure you read the License.txt file as with any other software product
- Open a command prompt window as Administrator (you cannot add a device to your system unless you "Run As Administrator")
- Run the following commands:
- cd c:\temp\usbmmid (or whatever destination folder you chose)
- deviceinstaller64 install usbmmidd.inf usbmmidd (If you are on a 32-bit system, replace "deviceinstaller64" by "deviceinstaller")
- Make sure you see the message that the drivers are signed by Amyuni Technologies Inc. This is a confirmation that the drivers went through Microsoft driver signing procedure and are virus free
- Starting with version 2, the virtual monitor supports the following display resolutions by default:
1024 x 768 pixels
1360 x 768 pixels
1440 x 900 pixels
1600 x 900 pixels
1600 x 1200 pixels
1920 x 1080 pixels [Default Resolution]
1920 x 1200 pixels
2560 x 1440 pixels
3840 x 2160 pixels
After the first step above is executed, you can modify the list of supported resolutions by changing the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WUDF\Services\usbmmIdd\Parameters\Monitors
Up to 10 resolutions can be defined through this registry key. The keys should be named from "0" to "9". The (Default) registry value defines the default monitor resolution.
Note that the list of resolutions can also be found in the usbmmidd.inf file that accompanies the printer driver. The inf file should not be modified in any way, otherwise the virtual display driver digital signature is invalidated.
Once you are satisfied with the list of resolutions, you can activate the virtual monitor by running:
- deviceinstaller64 enableidd 1
With version 2, rou can run this command multiple times to add up to 4 virtual monitors to your system.
The included batch file usbmmidd.bat runs these commands automatically and selects between the 32- or 64-bit version of deviceinstaller.
If you are not comfortable opening a command prompt and entering these commands, right-click on usbmmidd.bat and "Run As Administrator."
That's it. You now have a high definition monitor in your Display Settings. You can change the display resolution, position the monitor, extend the desktop or do whatever you do with a real monitor.
To deactivate the virtual monitor, run the command:
deviceinstaller64 enableidd 0
If ou have added more than one monitor, you should run this command multiple times to remove all monitors.
to reactivate a virtual monitor:
deviceinstaller64 enableidd 1
To completely remove the drivers from your system, you can either go through the Device Manager and uninstall "USB Mobile Monitor Virtual Display", or run the commands:
deviceinstaller64 stop usbmmidd
deviceinstaller64 remove usbmmid

Binary file not shown.

@ -1,16 +0,0 @@
@cd /d "%~dp0"
@goto %PROCESSOR_ARCHITECTURE%
@exit
:AMD64
@cmd /c deviceinstaller64.exe install usbmmidd.inf usbmmidd
@cmd /c deviceinstaller64.exe enableidd 1
@goto end
:x86
@cmd /c deviceinstaller.exe install usbmmidd.inf usbmmidd
@cmd /c deviceinstaller.exe enableidd 1
:end
@pause

Binary file not shown.

@ -82,7 +82,11 @@
<version>3.0.4-jdk17</version> <version>3.0.4-jdk17</version>
</dependency> </dependency>
<dependency>
<groupId>com.mashape.unirest</groupId>
<artifactId>unirest-java</artifactId>
<version>1.4.9</version>
</dependency>
<!--引用json库--> <!--引用json库-->
<dependency> <dependency>
<groupId>net.sf.json-lib</groupId> <groupId>net.sf.json-lib</groupId>

@ -1,5 +1,6 @@
package com.dsideal.QingLong.HuiYa.Controller; package com.dsideal.QingLong.HuiYa.Controller;
import com.alibaba.fastjson.JSONObject;
import com.dsideal.QingLong.HuiYa.Model.HuiYaModel; import com.dsideal.QingLong.HuiYa.Model.HuiYaModel;
import com.dsideal.QingLong.Interceptor.EmptyInterface; import com.dsideal.QingLong.Interceptor.EmptyInterface;
import com.dsideal.QingLong.Interceptor.IsNumericInterface; import com.dsideal.QingLong.Interceptor.IsNumericInterface;
@ -14,9 +15,12 @@ import com.jfinal.core.Controller;
import com.jfinal.ext.interceptor.POST; import com.jfinal.ext.interceptor.POST;
import com.jfinal.kit.HttpKit; import com.jfinal.kit.HttpKit;
import com.jfinal.kit.Kv; import com.jfinal.kit.Kv;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Page; import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record; import com.jfinal.plugin.activerecord.Record;
import com.mashape.unirest.http.exceptions.UnirestException;
import java.io.IOException;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -475,6 +479,93 @@ public class HuiYaController extends Controller {
renderJson(res); renderJson(res);
} }
/**
*
*
* @param token
* @param prompt
* @param limit 100
* @param platform_id = 1; 1: 2:
*/
@Before({POST.class})
@EmptyInterface({"token", "prompt"})
public void wxWenToWen(String token, String prompt, int limit, int platform_id) throws UnirestException {
//验证token
Kv res = ym.checkToken(token);
if (!res.getBoolean("success")) {
Kv kv = Kv.by("success", false);
kv.set("message", res.getStr("message"));
renderJson(kv);
return;
}
//换算出user_id
String user_id = res.getStr("user_id");
//金豆够用不够用?
//扣除金豆数量
int kouchu_jindou_count = 10;
int user_jd_count = ym.wxGetUserJinDou(user_id);
if (user_jd_count < kouchu_jindou_count) {
res.set("success", false);
res.set("message", "金豆数量不足!");
renderJson(res);
return;
}
String result = ym.wxWenToWen(prompt, limit, platform_id);
String content = JSONObject.parseObject(result).getJSONArray("choices").getJSONObject(0).getJSONObject("message").get("content").toString();
// 记录金豆消费日志
Record rUser = Db.findById("t_hy_user", "user_id", user_id);
int before_jd_count = rUser.getInt("jd_count");
int after_jd_count = before_jd_count - kouchu_jindou_count;
ym.wxAddJournal(user_id, 2, 0, 0, kouchu_jindou_count, before_jd_count, after_jd_count, "生方案消耗掉" + kouchu_jindou_count + "个金豆。");
Kv kv = Kv.by("success", true);
kv.set("message", content);
renderJson(kv);
}
/**
*
*
* @param token
* @param prompt
*/
@Before({POST.class})
@EmptyInterface({"token", "prompt"})
public void wxWenToVideo(String token, String prompt) {
//验证token
Kv res = ym.checkToken(token);
if (!res.getBoolean("success")) {
Kv kv = Kv.by("success", false);
kv.set("message", res.getStr("message"));
renderJson(kv);
return;
}
res.set("success", false);
res.set("message", "金豆数量不足!");
renderJson(res);
}
/**
*
*
* @param token
* @param prompt
*/
@Before({POST.class})
@EmptyInterface({"token", "prompt"})
public void wxWenToMusic(String token, String prompt) {
//验证token
Kv res = ym.checkToken(token);
if (!res.getBoolean("success")) {
Kv kv = Kv.by("success", false);
kv.set("message", res.getStr("message"));
renderJson(kv);
return;
}
res.set("success", false);
res.set("message", "金豆数量不足!");
renderJson(res);
}
/********************下面的内容是指Python图片生成器与WEB服务器交互使用,非小程序端支撑使用***********************/ /********************下面的内容是指Python图片生成器与WEB服务器交互使用,非小程序端支撑使用***********************/
/** /**
@ -580,4 +671,6 @@ public class HuiYaController extends Controller {
Kv kv = Kv.by("success", success).set("message", "保存成功!"); Kv kv = Kv.by("success", success).set("message", "保存成功!");
renderJson(kv); renderJson(kv);
} }
} }

@ -14,11 +14,19 @@ import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Page; import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record; import com.jfinal.plugin.activerecord.Record;
import com.jfinal.plugin.activerecord.SqlPara; import com.jfinal.plugin.activerecord.SqlPara;
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
import okhttp3.*;
import java.io.IOException;
import java.util.*; import java.util.*;
public class HuiYaModel { public class HuiYaModel {
static {
PropKit.use("application.properties");
}
/* /*
* openid * openid
@ -637,4 +645,32 @@ public class HuiYaModel {
} }
return list; return list;
} }
//# 第三方API接入
public static String token = "sk-amQHwiEzPIZIB2KuF5A10dC23a0e4b02B48a7a2b6aFa0662";
/**
*
*
* @param prompt
*/
public String wxWenToWen(String prompt, int limit, int platform_id) throws UnirestException {
//平台
String platform = "";
if (platform_id == 1) platform = "小红书风格";//小红书风格
if (platform_id == 2) platform = "微信朋友圈风格";//微信朋友圈
prompt = "帮我写一个" + platform + "方案,需要直接能够复制粘贴发表的方案,并且文字数量在" + limit + "个汉字左右:" + prompt;
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://goapi.gptnb.me/v1/chat/completions")
.header("Accept", "application/json")
.header("Authorization", "Bearer " + token)
.header("User-Agent", "Apifox/1.0.0 (https://apifox.com)")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-4o-mini\",\n \"messages\": [{\"role\": \"user\", \"content\": \"" + prompt + "\"}]\n}")
.asString();
return response.getBody();
}
} }

@ -41,4 +41,4 @@ MchID=1678768184
AdminID=16380C30-B1EA-4BFF-B5E6-4F3928CE36F3 AdminID=16380C30-B1EA-4BFF-B5E6-4F3928CE36F3
source_img_url=http://hzkc.oss-cn-beijing.aliyuncs.com/Images/Upload/20521cb7-680c-e80e-2655-939e53393175.png source_img_url=http://hzkc.oss-cn-beijing.aliyuncs.com/Images/Upload/20521cb7-680c-e80e-2655-939e53393175.png
# 初次使用时,赠送多少个金豆 # 初次使用时,赠送多少个金豆
INIT_JD_COUNT=10 INIT_JD_COUNT=10

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Loading…
Cancel
Save