Skip to content

Commit

Permalink
Merge pull request #406 from NexaAI/perry/server-dev
Browse files Browse the repository at this point in the history
fixed server list model problem for flux
  • Loading branch information
zhycheng614 authored Mar 1, 2025
2 parents bb4aea8 + a62fdce commit 01d3ceb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Files
*.safetensors
*.gguf
*.onnx
*.bin
*.mp3
*.wav
Expand Down
16 changes: 13 additions & 3 deletions nexa/gguf/server/nexa_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
NEXA_RUN_MODEL_MAP_FUNCTION_CALLING,
NEXA_MODEL_LIST_PATH,
NEXA_OFFICIAL_BUCKET,
NEXA_LIST_FILTERED_MODEL_PREFIXES,
)

from nexa.gguf.lib_utils import is_gpu_available
Expand Down Expand Up @@ -156,7 +157,7 @@ class ChatCompletionRequest(BaseModel):
class VLMChatCompletionRequest(BaseModel):
messages: List[Message] = [
{"role": "user", "content": [
{"type": "text", "text": "Whats in this image?"},
{"type": "text", "text": "What's in this image?"},
{"type": "image_url", "image_url": {
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
}}
Expand Down Expand Up @@ -1223,9 +1224,19 @@ async def list_models():
if NEXA_MODEL_LIST_PATH.exists():
with open(NEXA_MODEL_LIST_PATH, "r") as f:
model_list = json.load(f)

# Apply the same filtering logic as in nexa/general.py
filtered_list = {
model_name: model_info
for model_name, model_info in model_list.items()
if ':' not in model_name or
not any(model_name.split(':')[1].startswith(prefix) for prefix in NEXA_LIST_FILTERED_MODEL_PREFIXES)
}

return JSONResponse(content=filtered_list)
else:
model_list = {}
return JSONResponse(content=model_list)
return JSONResponse(content=model_list)
except Exception as e:
logging.error(f"Error listing models: {e}")
raise HTTPException(status_code=500, detail=str(e))
Expand Down Expand Up @@ -1726,7 +1737,6 @@ async def process_audio(
task_params = {
"beam_size": beam_size,
"temperature": temperature,
"vad_filter": True,
"task": task
}

Expand Down

0 comments on commit 01d3ceb

Please sign in to comment.