「小有可为」AI 开源公益创新挑战赛
- 相关信息
「小有可为」AI 开源公益创新挑战赛-开放原子大赛
Datawhale-学用 AI,从此开始
- 参赛内容
– 第一步静态网页提示词
模板搭建一个 【简述功能】 网页:【一句话简述你的网页功能/目的】
用于为乡村教师提供教学工具,更高效地完成教学任务,减轻教学负担
功能描述/功能点
- 【设置API KEY】要求用户首先输入真实的API KEY才可进入网页(并提醒,可访问 https://www.modelscope.cn/my/myaccesstoken 链接获取访问令牌)
- 【功能点1】
- 【功能点2】
...
技术栈与兼容性要求
网页基于【static HTML】实现。注意不要编写模拟实现的代码
AI调用示例
/*这个模型可以识别图片,并根据输入的文字指令完成任务*/
return fetch("https://api-inference.modelscope.cn/v1/chat/completions",{
method:"POST",headers:{"Content-Type":"application/json","Authorization":"Bearer " + token},body:JSON.stringify({model:"Qwen/Qwen3-VL-30B-A3B-Instruct",messages:[{role:"user",content:[{"type": "image_url", "image_url": {"url": xxx}}, {"type": "text", "text": prompt}]}],max_tokens:2048,temperature:0.7,enable_thinking: false})
}).then(r => {
if (!r.ok) {throw new Error(HTTP error! status: ${r.status});}return r.json();
})
/这个模型可以根据输入的文字生成图片/
async function generateImage(token, prompt) {
const response = await fetch("https://api-inference.modelscope.cn/v1/images/generations", {
method: "POST",headers: {"Content-Type": "application/json","Authorization": "Bearer " + token,},body: JSON.stringify({model: "black-forest-labs/FLUX.1-Krea-dev", // 文生图模型 IDprompt: prompt // 文本提示,例如 "A golden cat sitting on a windowsill"})
});
if (!response.ok) {
throw new ErrorHTTP error! status: ${response.status});
}
const result = await response.json();
return result;
}
// 使用示例
const token = "your_modelscope_api_token";
const prompt = "A golden cat";
generateImage(token, prompt)
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
搭建一个古诗文辅助理解记忆 网页:根据古诗文的意境生成对应图片辅助记忆的工具
用于为乡村教师提供教学工具,更高效地完成教学任务,减轻教学负担
功能描述/功能点
- 【设置API KEY】要求用户首先输入真实的API KEY才可进入网页(并提醒,可访问 https://www.modelscope.cn/my/myaccesstoken 链接获取访问令牌)
功能点 1:古诗文输入与意境图生成
这是工具的核心功能,需满足教师快速生成贴合文本的图片,且操作简单。
- 支持多形式输入:提供文本输入框,可粘贴古诗文全文或片段,也支持手动输入;输入后自动识别文本(如古诗、古文段落),无需额外选择文体。
- 风格与参数可选:提供 3-5 种适配古诗文的图片风格(如水墨风、工笔风、写实风),教师可根据课文场景选择;支持设置图片尺寸(如课件常用的 16:9、4:3),满足不同教学展示需求。
- 一键生成与预览:点击 “生成意境图” 按钮后,基于输入的 API KEY 调用模型生成图片;生成后在页面实时预览,若不满意可点击 “重新生成” 按钮再次调用,直至获取符合预期的图片。
功能点 2:教学辅助与素材管理
针对乡村教师 “减轻备课负担” 的需求,增加图片使用和素材留存功能,提升工具实用性。
- 图片导出与复用:预览满意后,支持一键下载图片(格式为 JPG/PNG,适配课件插入);提供 “复制图片链接” 功能,可直接粘贴到 PPT、教案文档中,避免反复保存操作。
- 古诗文基础解析:生成图片的同时,自动提取文本中的核心关键词(如 “明月”“孤舟”“边塞”),并提供简短的字词注释或句子大意(基于基础古诗文数据库),辅助教师快速梳理讲解重点,无需额外查资料。
- 历史记录留存:自动保存当前用户的生成记录(含输入的古诗文文本、生成的图片、生成时间),支持按时间或文本关键词搜索,方便教师后续重复使用同一课文的教学素材,减少重复操作。
...
技术栈与兼容性要求
网页基于【static HTML】实现。注意不要编写模拟实现的代码
AI调用示例
/*这个模型可以识别图片,并根据输入的文字指令完成任务*/
return fetch("https://api-inference.modelscope.cn/v1/chat/completions",{
method:"POST",headers:{"Content-Type":"application/json","Authorization":"Bearer " + token},body:JSON.stringify({model:"Qwen/Qwen3-VL-30B-A3B-Instruct",messages:[{role:"user",content:[{"type": "image_url", "image_url": {"url": xxx}}, {"type": "text", "text": prompt}]}],max_tokens:2048,temperature:0.7,enable_thinking: false})
}).then(r => {
if (!r.ok) {throw new Error(HTTP error! status: ${r.status});}return r.json();
})
/这个模型可以根据输入的文字生成图片/
async function generateImage(token, prompt) {
const response = await fetch("https://api-inference.modelscope.cn/v1/images/generations", {
method: "POST",headers: {"Content-Type": "application/json","Authorization": "Bearer " + token,},body: JSON.stringify({model: "black-forest-labs/FLUX.1-Krea-dev", // 文生图模型 IDprompt: prompt // 文本提示,例如 "A golden cat sitting on a windowsill"})
});
if (!response.ok) {
throw new ErrorHTTP error! status: ${response.status});
}
const result = await response.json();
return result;
}
// 使用示例
const token = "your_modelscope_api_token";
const prompt = "A golden cat";
generateImage(token, prompt)
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
