开启辅助访问 切换到宽版

精易论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

用微信号发送消息登录论坛

新人指南 邀请好友注册 - 我关注人的新帖 教你赚取精币 - 每日签到


求职/招聘- 论坛接单- 开发者大厅

论坛版规 总版规 - 建议/投诉 - 应聘版主 - 精华帖总集 积分说明 - 禁言标准 - 有奖举报

查看: 166|回复: 5
收起左侧

[易语言] 求大佬帮忙翻译java成易语言

[复制链接]
结帖率:33% (1/3)
发表于 4 天前 | 显示全部楼层 |阅读模式   山东省枣庄市
100精币
1. Install the Javascript client (docs) if you don't already have it installed.
copy
$ npm i -D @gradio/client

2. Find the API endpoint below corresponding to your desired function in the app. Copy the code snippet, replacing the placeholder values with your own input data. Or use the

API Recorder
to automatically generate your API requests.
api_name: [color=var(--color-accent)]/load_modelcopy
import { Client } from "@gradio/client";const client = await Client.connect([color=var(--color-accent-base)]"http://127.0.0.1:7860/"
);const result = await client.predict([color=var(--color-accent)]"/load_model", {                                 model: "情感模型", });console.log(result.data);




Accepts 1 parameter:

model string Default: "请先选择加载模型"
[color=var(--body-text-color-subdued)]The input value that is provided in the "模型" Dropdown component.




Returns list of 2 elements

[0] string
[color=var(--body-text-color-subdued)]The output value that appears in the "状态" Textbox component.


[1] string
[color=var(--body-text-color-subdued)]The output value that appears in the "模型" Dropdown component.



api_name: [color=var(--color-accent)]/model_inferencecopy
import { Client } from "@gradio/client";const response_0 = await fetch("undefined");const exampleFile = await response_0.blob();                                                const client = await Client.connect([color=var(--color-accent-base)]"http://127.0.0.1:7860/"
);const result = await client.predict([color=var(--color-accent)]"/model_inference", {                                 model: "情感模型",                                 video_input: exampleFile,                                 language: "自动",                                 hotwords: "Hello!!",                                 format_selector: "TXT",                                 speaker: true, });console.log(result.data);




Accepts 6 parameters:

model string Default: "请先选择加载模型"
[color=var(--body-text-color-subdued)]The input value that is provided in the "模型" Dropdown component.


video_input any Required
[color=var(--body-text-color-subdued)]The input value that is provided in the "上传音视频文件(可多选)" File component. null


language string Default: "自动"
[color=var(--body-text-color-subdued)]The input value that is provided in the "语言" Dropdown component.


hotwords string Default: "热词 用空格 隔开 十字鱼"
[color=var(--body-text-color-subdued)]The input value that is provided in the "热词" Textbox component.


format_selector string Default: "TXT"
[color=var(--body-text-color-subdued)]The input value that is provided in the "格式" Dropdown component.


speaker boolean Default: False
[color=var(--body-text-color-subdued)]The input value that is provided in the "识别说话人(仅热词模型支持)" Checkbox component.




Returns list of 3 elements

[0] string
[color=var(--body-text-color-subdued)]The output value that appears in the "状态" Textbox component.


[1] string
[color=var(--body-text-color-subdued)]The output value that appears in the "输出" Textbox component.


[2]
[color=var(--body-text-color-subdued)]The output value that appears in the "下载文件" File component.





回答提醒:如果本帖被关闭无法回复,您有更好的答案帮助楼主解决,请发表至 源码区 可获得加分喔。
友情提醒:本版被采纳的主题可在 申请荣誉值 页面申请荣誉值,获得 1点 荣誉值,荣誉值可兑换荣誉会员、终身vip用户组。
快捷通道:申请荣誉值无答案申请取消悬赏投诉有答案未采纳为最佳
结帖率:100% (5/5)

签到天数: 19 天

发表于 4 天前 | 显示全部楼层   山西省晋中市
你直接发开发文档链接或者文件还好看一点
回复

使用道具 举报

结帖率:33% (1/3)

签到天数: 3 天

 楼主| 发表于 4 天前 | 显示全部楼层   山东省枣庄市
404错误 发表于 2025-3-22 11:39
你直接发开发文档链接或者文件还好看一点

本地部署的、、、哥哥
回复

使用道具 举报

结帖率:33% (1/3)

签到天数: 3 天

 楼主| 发表于 4 天前 | 显示全部楼层   山东省枣庄市
404错误 发表于 2025-3-22 11:39
你直接发开发文档链接或者文件还好看一点

1. Install the Python client (docs) if you don't already have it installed.

copy
$ pip install gradio_client
2. Find the API endpoint below corresponding to your desired function in the app. Copy the code snippet, replacing the placeholder values with your own input data. Or use the
API Recorder

to automatically generate your API requests.

api_name: /load_model
copy
from gradio_client import Client

client = Client("http://127.0.0.1:7860/")
result = client.predict(
                model="请先选择加载模型",
                api_name="/load_model"
)
print(result)
Accepts 1 parameter:
model Literal['情感模型', '热词模型', '情感模型(带时间戳)', 'whisper-large-v3-turbo', 'whisper-large-v3', '请先选择加载模型'] Default: "请先选择加载模型"

The input value that is provided in the "模型" Dropdown component.
Returns tuple of 2 elements
[0] str

The output value that appears in the "状态" Textbox component.

[1] Literal['情感模型', '热词模型', '情感模型(带时间戳)', 'whisper-large-v3-turbo', 'whisper-large-v3', '请先选择加载模型']

The output value that appears in the "模型" Dropdown component.

api_name: /model_inference
copy
from gradio_client import Client, handle_file

client = Client("http://127.0.0.1:7860/")
result = client.predict(
                model="请先选择加载模型",
                video_input=[handle_file('https://github.com/gradio-app/gradio/raw/main/test/test_files/sample_file.pdf')],
                language="自动",
                hotwords="热词 用空格 隔开 十字鱼",
                format_selector="TXT",
                speaker=False,
                api_name="/model_inference"
)
print(result)
Accepts 6 parameters:
model Literal['情感模型', '热词模型', '情感模型(带时间戳)', 'whisper-large-v3-turbo', 'whisper-large-v3', '请先选择加载模型'] Default: "请先选择加载模型"

The input value that is provided in the "模型" Dropdown component.
video_input list[filepath] Required

The input value that is provided in the "上传音视频文件(可多选)" File component. null

language Literal['自动', '中文', '英文', '粤语', '日文', '韩文', '无语言'] Default: "自动"

The input value that is provided in the "语言" Dropdown component.
hotwords str Default: "热词 用空格 隔开 十字鱼"

The input value that is provided in the "热词" Textbox component.
format_selector Literal['TXT', 'LRC', 'SRT'] Default: "TXT"

The input value that is provided in the "格式" Dropdown component.
speaker bool Default: False

The input value that is provided in the "识别说话人(仅热词模型支持)" Checkbox component.
Returns tuple of 3 elements
[0] str

The output value that appears in the "状态" Textbox component.

[1] str

The output value that appears in the "输出" Textbox component.

[2] filepath

The output value that appears in the "下载文件" File component.  这是py
回复

使用道具 举报

结帖率:100% (5/5)

签到天数: 12 天

发表于 4 天前 | 显示全部楼层   内蒙古自治区呼伦贝尔市
连接到Gradio API并调用/load_model接口
.版本 2

.程序集 窗口程序集_启动窗口
.程序集变量 client, 对象
.程序集变量 result, 对象

.子程序 __启动窗口_创建完毕
    client.创建 (“WinHttp.WinHttpRequest.5.1”)
    client.方法 (“Open”, “POST”, “http://127.0.0.1:7860/load_model”, 假)
    client.方法 (“SetRequestHeader”, “Content-Type”, “application/json”)
    client.方法 (“Send”, “{""model"": ""情感模型""}”)
    result = client.方法 (“ResponseText”)
    输出调试文本 (result)

调用/model_inference接口
.版本 2

.程序集 窗口程序集_启动窗口
.程序集变量 client, 对象
.程序集变量 result, 对象
.程序集变量 exampleFile, 字节集

.子程序 __启动窗口_创建完毕
    exampleFile = HTTP读文件 (“http://example.com/path/to/video/file”)
   
    client.创建 (“WinHttp.WinHttpRequest.5.1”)
    client.方法 (“Open”, “POST”, “http://127.0.0.1:7860/model_inference”, 假)
    client.方法 (“SetRequestHeader”, “Content-Type”, “application/json”)
    client.方法 (“Send”, “{""model"": ""情感模型"", ""video_input"": ""” + 字节集到文本 (exampleFile) + “"", ""language"": ""自动"", ""hotwords"": ""Hello!!"", ""format_selector"": ""TXT"", ""speaker"": true}”)
    result = client.方法 (“ResponseText”)
    输出调试文本 (result)
回复

使用道具 举报

结帖率:33% (1/3)

签到天数: 3 天

 楼主| 发表于 4 天前 | 显示全部楼层   山东省枣庄市
xz0455 发表于 2025-3-22 13:07
连接到Gradio API并调用/load_model接口
.版本 2

大哥运行不起来,请给个e文件
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 致发广告者

发布主题 收藏帖子 返回列表

sitemap| 易语言源码| 易语言教程| 易语言论坛| 易语言模块| 手机版| 广告投放| 精易论坛
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表精易立场!
论坛帖子内容仅用于技术交流学习和研究的目的,严禁用于非法目的,否则造成一切后果自负!如帖子内容侵害到你的权益,请联系我们!
防范网络诈骗,远离网络犯罪 违法和不良信息举报电话0663-3422125,QQ: 793400750,邮箱:wp@125.la
网站简介:精易论坛成立于2009年,是一个程序设计学习交流技术论坛,隶属于揭阳市揭东区精易科技有限公司所有。
Powered by Discuz! X3.4 揭阳市揭东区精易科技有限公司 ( 粤ICP备12094385号-1) 粤公网安备 44522102000125 增值电信业务经营许可证 粤B2-20192173

快速回复 返回顶部 返回列表