mirror of
https://github.com/BoardWare-Genius/jarvis-models.git
synced 2025-12-13 16:53:24 +00:00
feat
This commit is contained in:
@ -3,14 +3,14 @@ from typing import Any, Coroutine
|
|||||||
from fastapi import Request, Response, status
|
from fastapi import Request, Response, status
|
||||||
from fastapi.responses import JSONResponse
|
from fastapi.responses import JSONResponse
|
||||||
|
|
||||||
from sentiment_engine.sentiment_engine import SentimentEngine
|
from ..sentiment_engine.sentiment_engine import SentimentEngine
|
||||||
from .blackbox import Blackbox
|
from .blackbox import Blackbox
|
||||||
|
|
||||||
|
|
||||||
class Sentiment(Blackbox):
|
class Sentiment(Blackbox):
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self.engine = SentimentEngine('resources/sentiment_engine/models/paimon_sentiment.onnx')
|
self.engine = SentimentEngine()
|
||||||
|
|
||||||
def __call__(self, *args, **kwargs):
|
def __call__(self, *args, **kwargs):
|
||||||
return self.processing(*args, **kwargs)
|
return self.processing(*args, **kwargs)
|
||||||
|
|||||||
@ -4,7 +4,7 @@ from ntpath import join
|
|||||||
from fastapi import Request, Response, status
|
from fastapi import Request, Response, status
|
||||||
from fastapi.responses import JSONResponse
|
from fastapi.responses import JSONResponse
|
||||||
from .blackbox import Blackbox
|
from .blackbox import Blackbox
|
||||||
from tts.tts_service import TTService
|
from ..tts.tts_service import TTService
|
||||||
|
|
||||||
class TTS(Blackbox):
|
class TTS(Blackbox):
|
||||||
|
|
||||||
|
|||||||
@ -4,12 +4,17 @@ import onnxruntime
|
|||||||
from transformers import BertTokenizer
|
from transformers import BertTokenizer
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
dirabspath = __file__.split("\\")[1:-1]
|
||||||
|
dirabspath= "C://" + "/".join(dirabspath)
|
||||||
|
default_path = dirabspath + "/models/paimon_sentiment.onnx"
|
||||||
|
|
||||||
|
|
||||||
class SentimentEngine():
|
class SentimentEngine():
|
||||||
|
|
||||||
def __init__(self, model_path="resources/sentiment_engine/models/paimon_sentiment.onnx"):
|
def __init__(self):
|
||||||
|
|
||||||
logging.info('Initializing Sentiment Engine...')
|
logging.info('Initializing Sentiment Engine...')
|
||||||
onnx_model_path = model_path
|
onnx_model_path = default_path
|
||||||
self.ort_session = onnxruntime.InferenceSession(onnx_model_path, providers=['CPUExecutionProvider'])
|
self.ort_session = onnxruntime.InferenceSession(onnx_model_path, providers=['CPUExecutionProvider'])
|
||||||
self.tokenizer = BertTokenizer.from_pretrained('bert-base-chinese')
|
self.tokenizer = BertTokenizer.from_pretrained('bert-base-chinese')
|
||||||
|
|
||||||
@ -1,19 +1,19 @@
|
|||||||
import io
|
import io
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.append('tts/vits')
|
sys.path.append('src/tts/vits')
|
||||||
|
|
||||||
import soundfile
|
import soundfile
|
||||||
import os
|
import os
|
||||||
os.environ["PYTORCH_JIT"] = "0"
|
os.environ["PYTORCH_JIT"] = "0"
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
import tts.vits.commons as commons
|
import src.tts.vits.commons as commons
|
||||||
import tts.vits.utils as utils
|
import src.tts.vits.utils as utils
|
||||||
|
|
||||||
from tts.vits.models import SynthesizerTrn
|
from src.tts.vits.models import SynthesizerTrn
|
||||||
from tts.vits.text.symbols import symbols
|
from src.tts.vits.text.symbols import symbols
|
||||||
from tts.vits.text import text_to_sequence
|
from src.tts.vits.text import text_to_sequence
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
logging.getLogger().setLevel(logging.INFO)
|
logging.getLogger().setLevel(logging.INFO)
|
||||||
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
Reference in New Issue
Block a user