Compare commits
2 Commits
5ff60df3d3
...
8e0cc81283
| Author | SHA1 | Date |
|---|---|---|
|
|
8e0cc81283 | |
|
|
b442e4f336 |
|
|
@ -0,0 +1,118 @@
|
|||
{
|
||||
"Env": [
|
||||
{
|
||||
"Name": "10楼刀片机",
|
||||
"ServerList": [],
|
||||
"LinuxServerList": [
|
||||
{
|
||||
"UserName": "hy",
|
||||
"Pwd": "E9D1AC136FDD59740A9595ABD0EB953A",
|
||||
"Host": "192.168.2.21:10107",
|
||||
"NickName": "",
|
||||
"IIsFireUrl": null,
|
||||
"DockerFireUrl": "https://videoanalysis.w.23544.com:8843/",
|
||||
"WindowsServiceFireUrl": null,
|
||||
"LinuxServiceFireUrl": null
|
||||
}
|
||||
],
|
||||
"IgnoreList": [
|
||||
"ffmpeg.exe"
|
||||
],
|
||||
"WindowsBackUpIgnoreList": []
|
||||
}
|
||||
],
|
||||
"IIsConfig": {
|
||||
"SdkType": null,
|
||||
"WebSiteName": "",
|
||||
"LastEnvName": null,
|
||||
"EnvPairList": [
|
||||
{
|
||||
"EnvName": "10楼刀片机",
|
||||
"ConfigName": "",
|
||||
"LinuxEnvParam": null,
|
||||
"DockerPort": null,
|
||||
"DockerEnvName": null,
|
||||
"DockerVolume": null,
|
||||
"DockerOther": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"WindowsServiveConfig": {
|
||||
"ServiceName": "",
|
||||
"SdkType": null,
|
||||
"LastEnvName": null,
|
||||
"EnvPairList": [
|
||||
{
|
||||
"EnvName": "10楼刀片机",
|
||||
"ConfigName": "",
|
||||
"LinuxEnvParam": null,
|
||||
"DockerPort": null,
|
||||
"DockerEnvName": null,
|
||||
"DockerVolume": null,
|
||||
"DockerOther": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"LinuxServiveConfig": {
|
||||
"ServiceName": "",
|
||||
"EnvParam": "",
|
||||
"LastEnvName": null,
|
||||
"EnvPairList": [
|
||||
{
|
||||
"EnvName": "10楼刀片机",
|
||||
"ConfigName": "",
|
||||
"LinuxEnvParam": null,
|
||||
"DockerPort": null,
|
||||
"DockerEnvName": null,
|
||||
"DockerVolume": null,
|
||||
"DockerOther": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"DockerConfig": {
|
||||
"Prot": "9040",
|
||||
"AspNetCoreEnv": "",
|
||||
"LastEnvName": "10楼刀片机",
|
||||
"RemoveDaysFromPublished": "10",
|
||||
"WorkDir": "",
|
||||
"Volume": "/home/hy/VideoAnalysis/AICore:/app/AICore/_Static;/home/hy//VideoAnalysis/TaskCachedFile:/app/TaskCachedFile",
|
||||
"Other": "",
|
||||
"EnvPairList": [
|
||||
{
|
||||
"EnvName": "10楼刀片机",
|
||||
"ConfigName": null,
|
||||
"LinuxEnvParam": null,
|
||||
"DockerPort": "9040",
|
||||
"DockerEnvName": "",
|
||||
"DockerVolume": "/home/hy/VideoAnalysis/AICore:/app/AICore/_Static;/home/hy//VideoAnalysis/TaskCachedFile:/app/TaskCachedFile",
|
||||
"DockerOther": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
"DockerImageConfig": {
|
||||
"BaseHttpProxy": "",
|
||||
"BaseImage": "",
|
||||
"BaseImageCredential": {
|
||||
"UserName": "",
|
||||
"Password": ""
|
||||
},
|
||||
"TargetImage": "",
|
||||
"TargetHttpProxy": "",
|
||||
"TargetTags": [
|
||||
""
|
||||
],
|
||||
"TargetImageCredential": {
|
||||
"UserName": "",
|
||||
"Password": ""
|
||||
},
|
||||
"ImageFormat": "Docker",
|
||||
"Entrypoint": [
|
||||
""
|
||||
],
|
||||
"Cmd": [
|
||||
""
|
||||
],
|
||||
"IgnoreList": [],
|
||||
"SkipExistingImages": false
|
||||
}
|
||||
}
|
||||
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
<PageTitle>Error</PageTitle>
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
<h1 class="text-danger">错误页面.</h1>
|
||||
<h2 class="text-danger">处理您的请求时出错。</h2>
|
||||
|
||||
@if (ShowRequestId)
|
||||
{
|
||||
|
|
@ -13,15 +13,15 @@
|
|||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<h3>开发模式</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
切换到<strong>Development</strong>环境将显示有关发生的错误的更多详细信息。
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
<strong> 不应为已部署的应用程序启用开发环境。</strong>
|
||||
它可能导致向最终用户显示来自异常的敏感信息。
|
||||
对于本地调试,通过将 <strong>ASPNETCORE_ENVIRONMENT</strong> 环境变量设置为 <strong>Development</strong> 来启用 <strong> 开发 </strong> 环境
|
||||
并重新启动应用程序。
|
||||
</p>
|
||||
|
||||
@code{
|
||||
|
|
|
|||
|
|
@ -61,9 +61,16 @@ namespace VideoAnalysisRazor.Layouts
|
|||
}
|
||||
|
||||
public async Task<bool> CheckLogin()
|
||||
{
|
||||
try
|
||||
{
|
||||
return (await session.GetAsync<bool>("Login")).Value;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
void Reload()
|
||||
{
|
||||
TabService.ReloadPage();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using AntDesign.TableModels;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using SqlSugar;
|
||||
using System.Linq.Expressions;
|
||||
|
|
@ -8,7 +7,6 @@ using VideoAnalysisCore.Model;
|
|||
|
||||
namespace Learn.VideoAnalysis.Components.Pages
|
||||
{
|
||||
[Authorize]
|
||||
public partial class EvaluationProject : ComponentBase
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<div class="container">
|
||||
<div class="form">
|
||||
<h2>登录 视频分析平台</h2>
|
||||
<form>
|
||||
<div class="cform">
|
||||
<div class="inputBox">
|
||||
<input type="text" placeholder="账号" @bind="InputAccount">
|
||||
</div>
|
||||
|
|
@ -47,7 +47,7 @@
|
|||
注册
|
||||
</a>
|
||||
</p> *@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -89,19 +89,18 @@ namespace Learn.VideoAnalysis.Controllers
|
|||
var mergedList = new List<TimeBase>();
|
||||
// 初始化合并段
|
||||
var current = timeBases.First();
|
||||
current.Content = string.Empty;
|
||||
foreach (var next in timeBases)
|
||||
{
|
||||
// 如果类型相同,则扩展时间段
|
||||
if (current.TimeBaseType == next.TimeBaseType)
|
||||
{
|
||||
current.End = Math.Max(current.End, next.End);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 类型不同,将当前时间段加入结果列表,并开始新时间段
|
||||
current.Content = string.Empty;
|
||||
mergedList.Add(current);
|
||||
current = next;
|
||||
current.Content = string.Empty;
|
||||
}
|
||||
}
|
||||
// 添加最后的时间段
|
||||
|
|
@ -114,10 +113,9 @@ namespace Learn.VideoAnalysis.Controllers
|
|||
/// </summary>
|
||||
/// <param name="taskId"></param>
|
||||
/// <param name="tagId">自定义id</param>
|
||||
/// <param name="needSubtitle">是否附加字幕</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet(Name = "TaskInfo")]
|
||||
public async Task<IActionResult> TaskInfo(long taskId,string? tagId,bool needSubtitle=false)
|
||||
public async Task<IActionResult> TaskInfo(long taskId,string? tagId)
|
||||
{
|
||||
var task = await videoTaskDB.AsQueryable()
|
||||
.WhereIF(taskId!=0, s => s.Id == taskId)
|
||||
|
|
@ -131,7 +129,7 @@ namespace Learn.VideoAnalysis.Controllers
|
|||
taskData.Status = task.LastEnum;
|
||||
if (task.LastEnum != RedisChannelEnum.EndTask)
|
||||
return BadRequest(taskData);
|
||||
if (!needSubtitle && taskData != null && taskData.TimeBase != null)
|
||||
if (taskData != null && taskData.TimeBase != null)
|
||||
taskData.TimeBase = MergeTimeBases(taskData.TimeBase);
|
||||
return Ok(taskData);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
|
||||
FROM dotnet/aspnet:8.0
|
||||
|
||||
RUN ["apt-get", "--assume-yes", "update"]
|
||||
RUN ["apt-get", "--assume-yes", "install", "ffmpeg"]
|
||||
|
||||
WORKDIR /app
|
||||
EXPOSE 9040
|
||||
|
||||
COPY . .
|
||||
#设置时间为中国上海 环境为开发环境
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
|
||||
#RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ sid main contrib non-free" > /etc/apt/sources.list
|
||||
#RUN apt-get update && apt-get install -y apt-transport-https ca-certificates apt-utils libgdiplus libc6-dev && apt-get install -y libfreetype6 && apt-get install -y libfontconfig1 && apt-get install -y fontconfig
|
||||
#
|
||||
ENV ASPNETCORE_URLS=http://+:9040
|
||||
|
||||
ENTRYPOINT ["dotnet", "Learn.VideoAnalysis.dll"]
|
||||
|
|
@ -15,6 +15,16 @@
|
|||
<None Remove="AICore\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Dockerfile" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Dockerfile">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\VideoAnalysisCore\VideoAnalysisCore.csproj" />
|
||||
<PackageReference Include="Mapster.DependencyInjection" Version="1.0.2-pre01" />
|
||||
|
|
|
|||
|
|
@ -55,6 +55,10 @@ namespace Learn.VideoAnalysis
|
|||
RedisExpand.Init();
|
||||
Speaker.Init();
|
||||
//SenseVoice.Init();
|
||||
builder.Services.AddControllersWithViews(options =>
|
||||
{
|
||||
options.Filters.Add(typeof(ExceptionFilter));
|
||||
});
|
||||
|
||||
|
||||
builder.Services.AddScoped(sp =>
|
||||
|
|
@ -94,8 +98,11 @@ namespace Learn.VideoAnalysis
|
|||
app.UseSwaggerUI();
|
||||
app.UseExceptionHandler("/Error");
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// app.UseExceptionHandler("/Login");
|
||||
//}
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseStaticFiles();
|
||||
app.UseAntiforgery();
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Error",
|
||||
"Microsoft.AspNetCore": "Error"
|
||||
}
|
||||
},
|
||||
"AppConfig": {
|
||||
"Redis": {
|
||||
"ConnectionString": "10.255.255.3,password=qwe123!@#,defaultDatabase=3"
|
||||
},
|
||||
"FFmpeg": {
|
||||
" TimeSlice": 600
|
||||
},
|
||||
"DB": {
|
||||
"ConnectionString": "AllowLoadLocalInfile=true;Server=10.255.255.3;Port=3306;Database=learn.videoanalysis;User ID=marking;Password=qwe123!@#;CharSet=utf8mb4;pooling=true;SslMode=None",
|
||||
"SqlType": "MySql",
|
||||
"UpdateTable": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -63,8 +63,8 @@ namespace VideoAnalysisCore.AICore.ChatGPT.Dto
|
|||
/// <para>满分100</para>
|
||||
/// </summary>
|
||||
public float AssessmentScore =>
|
||||
(float)(Assessment?.Bad?.Select(x => x.Score)
|
||||
(float)Math.Round((Assessment?.Bad?.Select(x => x.Score)
|
||||
.Concat(Assessment?.Merit?.Select(s => s.Score) ?? [])
|
||||
.Average() ?? 0) * 100;
|
||||
.Average() ?? 0) * 10,2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using VideoAnalysisCore.Common;
|
|||
using System.Threading.Tasks;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
using System.Xml.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace VideoAnalysisCore.AICore.FFMPGE
|
||||
{
|
||||
|
|
@ -16,7 +17,9 @@ namespace VideoAnalysisCore.AICore.FFMPGE
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static string FFmpegPath = Path.Combine(AppCommon.AIModelFile, "ffmpeg.exe");
|
||||
public static string FFmpegPath = RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
|
||||
? $"/usr/bin/ffmpeg"
|
||||
: Path.Combine(AppCommon.AIModelFile, "ffmpeg.exe");
|
||||
/// <summary>
|
||||
/// 音频转码为 wav_16k
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VideoAnalysisCore.Common
|
||||
{
|
||||
public class ExceptionFilter : IAsyncExceptionFilter
|
||||
{
|
||||
readonly NavigationManager nm;
|
||||
public ExceptionFilter(NavigationManager nm)
|
||||
{
|
||||
this.nm = nm;
|
||||
}
|
||||
|
||||
public async Task OnExceptionAsync(ExceptionContext context)
|
||||
{
|
||||
if (context.Exception is InvalidOperationException)
|
||||
{
|
||||
nm.NavigateTo("/Login");
|
||||
}
|
||||
else
|
||||
{
|
||||
// 创建一个包含错误信息的对象
|
||||
var errorObject = new
|
||||
{
|
||||
ErrorMessage = context.Exception.Message,
|
||||
StackTrace = context.Exception.StackTrace,
|
||||
};
|
||||
// 将错误对象序列化为JSON格式
|
||||
var json = JsonSerializer.Serialize(errorObject);
|
||||
|
||||
// 设置响应内容类型为JSON
|
||||
context.HttpContext.Response.ContentType = "application/json";
|
||||
// 设置状态码
|
||||
context.HttpContext.Response.StatusCode = 500;
|
||||
// 将JSON数据写入响应体
|
||||
await context.HttpContext.Response.WriteAsync(json);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -92,7 +92,11 @@ namespace VideoAnalysisCore.Common
|
|||
Console.WriteLine("初始化 redis");
|
||||
Redis.Serialize = obj => System.Text.Json.JsonSerializer.Serialize(obj);
|
||||
Redis.Deserialize = (json, type) => System.Text.Json.JsonSerializer.Deserialize(json, type);
|
||||
Task.Run(() =>
|
||||
{
|
||||
Task.Delay(1000 * 5);
|
||||
InitChannel();
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -8,10 +8,6 @@
|
|||
|
||||
<ItemGroup>
|
||||
<None Remove="AICore\_Static\ffmpeg.exe" />
|
||||
<None Remove="AICore\_Static\ggml-base.bin" />
|
||||
<None Remove="AICore\_Static\ggml-large-v3.bin" />
|
||||
<None Remove="AICore\_Static\ggml-medium.bin" />
|
||||
<None Remove="AICore\_Static\ggml-small.bin" />
|
||||
<None Remove="AICore\_Static\sherpa-onnx-pyannote-segmentation-3-0\model.int8.onnx" />
|
||||
<None Remove="AICore\_Static\sherpa-onnx-pyannote-segmentation-3-0\model.onnx" />
|
||||
<None Remove="AICore\_Static\wespeaker\wespeaker_zh_cnceleb_resnet34_LM.onnx" />
|
||||
|
|
@ -19,28 +15,16 @@
|
|||
|
||||
<ItemGroup>
|
||||
<Content Include="AICore\_Static\ffmpeg.exe">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="AICore\_Static\ggml-base.bin">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="AICore\_Static\ggml-large-v3.bin">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="AICore\_Static\ggml-medium.bin">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="AICore\_Static\ggml-small.bin">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="AICore\_Static\sherpa-onnx-pyannote-segmentation-3-0\model.int8.onnx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="AICore\_Static\sherpa-onnx-pyannote-segmentation-3-0\model.onnx">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="AICore\_Static\wespeaker\wespeaker_zh_cnceleb_resnet34_LM.onnx">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
|
|
@ -48,6 +32,7 @@
|
|||
<PackageReference Include="FreeRedis" Version="1.3.2" />
|
||||
<PackageReference Include="Downloader" Version="3.2.1" />
|
||||
<PackageReference Include="Mapster" Version="7.4.1-pre01" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue