mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-16 14:52:31 +00:00
Nicer TTS Inference Results (text, title, styling)
This commit is contained in:
1 parent
23cf9b0b99
commit
a355d4c1e4
5 files changed
+54
-16
No files matched your search
@@ -343,8 +343,8 @@ class ApiConfig {
|
||||
}
|
||||
|
||||
obsEventsWebsocket(twitchUsername: string) : string {
|
||||
//return `ws://localhost:54321/obs/${twitchUsername}`;
|
||||
return `wss://obs.storyteller.io/obs/${twitchUsername}`;
|
||||
return `ws://localhost:54321/obs/${twitchUsername}`;
|
||||
//return `wss://obs.storyteller.io/obs/${twitchUsername}`;
|
||||
}
|
||||
|
||||
private getScheme() : string {
|
||||
|
||||
@@ -11,7 +11,7 @@ class BucketConfig {
|
||||
this.isLocalDev = false;
|
||||
}
|
||||
// TODO TEMP
|
||||
this.isLocalDev = false;
|
||||
//this.isLocalDev = false;
|
||||
}
|
||||
|
||||
// TODO: Prevent callers with undefined/null paths
|
||||
|
||||
@@ -26,6 +26,8 @@ export interface TtsInferenceJobStatus {
|
||||
tts_model_type: string,
|
||||
title: string,
|
||||
|
||||
raw_inference_text: string,
|
||||
|
||||
created_at: Date,
|
||||
updated_at: Date,
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
import { TtsInferenceJobStatus } from "../api/jobs/GetTtsInferenceJobStatus";
|
||||
import { JobState, jobStateFromString } from "./JobStates";
|
||||
|
||||
// NB: Many of these fields are optional despite the response payload containing them
|
||||
// This is because we create temporary placeholder objects with just the token.
|
||||
export class TtsInferenceJob {
|
||||
jobToken: string;
|
||||
modelToken?: string;
|
||||
jobState: JobState;
|
||||
maybeExtraStatusDescription: string | null;
|
||||
attemptCount: number;
|
||||
title?: string;
|
||||
title?: string; // Name of the TTS model
|
||||
rawInferenceText?: string;
|
||||
maybeResultToken: string | undefined | null;
|
||||
maybePublicBucketWavAudioPath: string | undefined | null;
|
||||
|
||||
@@ -18,6 +21,7 @@ export class TtsInferenceJob {
|
||||
attemptCount: number = 0,
|
||||
modelToken: string | undefined = undefined,
|
||||
title: string | undefined = undefined,
|
||||
rawInferenceText: string | undefined = undefined,
|
||||
maybeResulToken: string | undefined | null = null,
|
||||
maybePublicBucketWavAudioPath: string | undefined | null = null,
|
||||
) {
|
||||
@@ -32,6 +36,7 @@ export class TtsInferenceJob {
|
||||
if (!!title) {
|
||||
this.title = title;
|
||||
}
|
||||
this.rawInferenceText = rawInferenceText;
|
||||
this.maybePublicBucketWavAudioPath = maybePublicBucketWavAudioPath;
|
||||
}
|
||||
|
||||
@@ -43,6 +48,7 @@ export class TtsInferenceJob {
|
||||
response.attempt_count || 0,
|
||||
response.model_token,
|
||||
response.title,
|
||||
response.raw_inference_text,
|
||||
response.maybe_result_token || null,
|
||||
response.maybe_public_bucket_wav_audio_path || null,
|
||||
);
|
||||
@@ -64,6 +70,7 @@ export interface TtsInferenceJobState {
|
||||
model_token: string,
|
||||
tts_model_type: string,
|
||||
title: string,
|
||||
raw_inference_text: string,
|
||||
created_at: string,
|
||||
updated_at: string,
|
||||
}
|
||||
@@ -15,6 +15,7 @@ function SessionTtsInferenceResultListFc(props: Props) {
|
||||
props.ttsInferenceJobs.forEach(job => {
|
||||
|
||||
if (!job.maybeResultToken) {
|
||||
let cssStyle = "message";
|
||||
let stateDescription = "Pending...";
|
||||
|
||||
switch (job.jobState) {
|
||||
@@ -23,39 +24,65 @@ function SessionTtsInferenceResultListFc(props: Props) {
|
||||
stateDescription = job.maybeExtraStatusDescription == null ? "Pending..." : job.maybeExtraStatusDescription;
|
||||
break;
|
||||
case JobState.STARTED:
|
||||
cssStyle = "message is-primary";
|
||||
stateDescription = job.maybeExtraStatusDescription == null ? "Started..." : job.maybeExtraStatusDescription;
|
||||
break;
|
||||
case JobState.ATTEMPT_FAILED:
|
||||
cssStyle = "message is-warning";
|
||||
stateDescription = `Failed ${job.attemptCount} attempt(s). Will retry...`;
|
||||
break;
|
||||
case JobState.COMPLETE_FAILURE:
|
||||
case JobState.DEAD:
|
||||
cssStyle = "message is-danger";
|
||||
stateDescription = "Failed Permanently. Please tell us in Discord so we can fix. :(";
|
||||
break;
|
||||
case JobState.COMPLETE_SUCCESS:
|
||||
cssStyle = "message is-success";
|
||||
stateDescription = "Success!"; // Not sure why we're here instead of other branch!
|
||||
break;
|
||||
}
|
||||
|
||||
results.push(
|
||||
<div key={job.jobToken}>{stateDescription}</div>
|
||||
<div key={job.jobToken}>
|
||||
<article className={cssStyle}>
|
||||
<div className="message-body">
|
||||
<p>
|
||||
{stateDescription}
|
||||
</p>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
let audioLink = new BucketConfig().getGcsUrl(job.maybePublicBucketWavAudioPath);
|
||||
let ttsPermalink = `/tts/result/${job.maybeResultToken}`
|
||||
results.push(
|
||||
<div key={job.jobToken}>
|
||||
<audio
|
||||
controls
|
||||
src={audioLink}>
|
||||
Your browser does not support the
|
||||
<code>audio</code> element.
|
||||
</audio>
|
||||
<article className="message is-dark">
|
||||
{/*<div className="message-header">
|
||||
<p>{job.title}</p>
|
||||
<button className="delete" aria-label="delete"></button>
|
||||
</div>*/}
|
||||
<div className="message-body">
|
||||
<strong>{job.title}</strong>
|
||||
<p>{job.rawInferenceText}</p>
|
||||
|
||||
<Link
|
||||
to={ttsPermalink}
|
||||
className="button is-normal is-outlined is-info"
|
||||
>Permalink & download</Link>
|
||||
<audio
|
||||
controls
|
||||
src={audioLink}>
|
||||
Your browser does not support the
|
||||
<code>audio</code> element.
|
||||
</audio>
|
||||
|
||||
|
||||
<Link
|
||||
to={ttsPermalink}
|
||||
className="button is-normal is-outlined is-dark"
|
||||
>Permalink & download</Link>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -70,6 +97,9 @@ function SessionTtsInferenceResultListFc(props: Props) {
|
||||
title = <h4 className="title is-4">Session TTS Results</h4>;
|
||||
}
|
||||
|
||||
// Users have requested reverse chronological results
|
||||
results.reverse();
|
||||
|
||||
return (
|
||||
<div>
|
||||
{title}
|
||||
@@ -79,7 +109,6 @@ function SessionTtsInferenceResultListFc(props: Props) {
|
||||
Sorry this is slow. I'm scaling the cluster and fixing the caching strategy.
|
||||
</p>
|
||||
</div>*/}
|
||||
<br />
|
||||
{results}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user