mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-12 12:53:04 +00:00
This works! 200s from the other microservice
This commit is contained in:
1 parent
8d28402172
commit
1ff11a46fc
2 files changed
+20
-6
No files matched your search
@@ -42,6 +42,13 @@ pub struct SpeakSpectrogramResponse {
|
||||
pub spectrogram: Base64MelSpectrogram,
|
||||
}
|
||||
|
||||
#[derive(Serialize,Debug)]
|
||||
struct RecordRequest {
|
||||
remote_ip_address: String,
|
||||
text: String,
|
||||
speaker: String,
|
||||
}
|
||||
|
||||
pub async fn post_speak_with_spectrogram(request: HttpRequest,
|
||||
query: Json<SpeakRequest>,
|
||||
app_state: Data<Arc<AppState>>)
|
||||
@@ -51,11 +58,6 @@ pub async fn post_speak_with_spectrogram(request: HttpRequest,
|
||||
|
||||
let client = Client::new();
|
||||
|
||||
let result = client.get("http://localhost:11111/test")
|
||||
.no_decompress()
|
||||
.send()
|
||||
.await;
|
||||
|
||||
let ip_address = get_request_ip(&request);
|
||||
|
||||
if let Err(err) = app_state.rate_limiter.maybe_ratelimit_request(&ip_address, &request.headers()) {
|
||||
@@ -64,6 +66,18 @@ pub async fn post_speak_with_spectrogram(request: HttpRequest,
|
||||
|
||||
let speaker_slug = query.speaker.to_string();
|
||||
|
||||
let r = RecordRequest {
|
||||
remote_ip_address: "1.1.1.1".to_string(),
|
||||
speaker: query.speaker.to_string(),
|
||||
text: query.text.to_string(),
|
||||
};
|
||||
|
||||
let result = client.post("http://localhost:11111/sentence")
|
||||
.no_decompress()
|
||||
.header(header::CONTENT_TYPE, "application/json")
|
||||
.send_json(&r)
|
||||
.await;
|
||||
|
||||
let speaker = match app_state.model_configs.find_speaker_by_slug(&speaker_slug) {
|
||||
Some(speaker) => speaker,
|
||||
None => {
|
||||
|
||||
@@ -74,7 +74,7 @@ const ENV_RUST_LOG : &'static str = "RUST_LOG";
|
||||
|
||||
const DEFAULT_ASSET_DIRECTORY : &'static str = "/home/bt/dev/voice/voder/tts_frontend/build";
|
||||
const DEFAULT_BIND_ADDRESS : &'static str = "0.0.0.0:12345";
|
||||
const DEFAULT_DATABASE_ENABLED : bool = true;
|
||||
const DEFAULT_DATABASE_ENABLED : bool = false;
|
||||
const DEFAULT_DATABASE_URL : &'static str = "mysql://root:root@localhost/mumble";
|
||||
const DEFAULT_DEFAULT_SAMPLE_RATE_HZ : u32 = 22050;
|
||||
const DEFAULT_MAX_CHAR_LEN : usize = 255;
|
||||
|
||||
Reference in new issue
Block a user