Skip to content

Commit

Permalink
BUG: fix client import (#1905)
Browse files Browse the repository at this point in the history
Co-authored-by: wuzhaoxin <[email protected]>
  • Loading branch information
amumu96 and wuzhaoxin authored Jul 19, 2024
1 parent 35c3008 commit 880929c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
8 changes: 2 additions & 6 deletions xinference/api/restful_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@

from .._compat import BaseModel, Field
from .._version import get_versions
from ..constants import (
XINFERENCE_AUDIO_SPEECH_DEFAULT_STREAM,
XINFERENCE_DEFAULT_ENDPOINT_PORT,
XINFERENCE_DISABLE_METRICS,
)
from ..constants import XINFERENCE_DEFAULT_ENDPOINT_PORT, XINFERENCE_DISABLE_METRICS
from ..core.event import Event, EventCollectorActor, EventType
from ..core.supervisor import SupervisorActor
from ..core.utils import json_dumps
Expand Down Expand Up @@ -133,7 +129,7 @@ class SpeechRequest(BaseModel):
voice: Optional[str]
response_format: Optional[str] = "mp3"
speed: Optional[float] = 1.0
stream: Optional[bool] = XINFERENCE_AUDIO_SPEECH_DEFAULT_STREAM
stream: Optional[bool] = False


class RegisterModelRequest(BaseModel):
Expand Down
3 changes: 1 addition & 2 deletions xinference/client/restful/restful_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import requests

from ...constants import XINFERENCE_AUDIO_SPEECH_DEFAULT_STREAM
from ..common import streaming_response_iterator

if TYPE_CHECKING:
Expand Down Expand Up @@ -768,7 +767,7 @@ def speech(
voice: str = "",
response_format: str = "mp3",
speed: float = 1.0,
stream: bool = XINFERENCE_AUDIO_SPEECH_DEFAULT_STREAM,
stream: bool = False,
):
"""
Generates audio from the input text.
Expand Down
4 changes: 0 additions & 4 deletions xinference/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
XINFERENCE_ENV_ENABLE_SGLANG = "XINFERENCE_ENABLE_SGLANG"
XINFERENCE_ENV_DISABLE_METRICS = "XINFERENCE_DISABLE_METRICS"
XINFERENCE_ENV_TRANSFORMERS_ENABLE_BATCHING = "XINFERENCE_TRANSFORMERS_ENABLE_BATCHING"
XINFERENCE_ENV_AUDIO_SPEECH_DEFAULT_STREAM = "XINFERENCE_AUDIO_SPEECH_DEFAULT_STREAM"


def get_xinference_home() -> str:
Expand Down Expand Up @@ -81,6 +80,3 @@ def get_xinference_home() -> str:
XINFERENCE_TRANSFORMERS_ENABLE_BATCHING = bool(
int(os.environ.get(XINFERENCE_ENV_TRANSFORMERS_ENABLE_BATCHING, 0))
)
XINFERENCE_AUDIO_SPEECH_DEFAULT_STREAM = bool(
int(os.environ.get(XINFERENCE_ENV_AUDIO_SPEECH_DEFAULT_STREAM, 0))
)

0 comments on commit 880929c

Please sign in to comment.