Spaces:
Runtime error
Runtime error
Download src/app.py from Lemorra/Qwen2.5-VL-3B-Instruct-Backend-API: direct link, hf CLI and curl.
- Browser
- Download file 952 Bytes
-
https://huggingface.co/spaces/Lemorra/Qwen2.5-VL-3B-Instruct-Backend-API/resolve/main/src/app.py
- Command line
-
hf download hf://spaces/Lemorra/Qwen2.5-VL-3B-Instruct-Backend-API/src/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Lemorra/Qwen2.5-VL-3B-Instruct-Backend-API/resolve/main/src/app.py
952 Bytes
| from pyexpat import model | |
| from typing import Annotated | |
| from fastapi import FastAPI, Depends | |
| from .utils.authentication import verify_token | |
| from .utils.payload_model import SingleInferencePayload, VideoInferencePayload | |
| from .utils.qwen_inference import Qwen2_5 | |
| import os | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| model_path = os.getenv("MODEL_PATH") | |
| model_object = Qwen2_5(model_path) | |
| app = FastAPI() | |
| def greet_json(): | |
| return { | |
| "message": "Welcome! The backend API for Qwen2.5-VL-3B-Instruct model is running.", | |
| "status": "active" | |
| } | |
| def single_inference(payload: SingleInferencePayload, _token: Annotated[dict, Depends(verify_token)]): | |
| return model_object.get_single_inference(payload) | |
| def video_inference(payload: VideoInferencePayload, _token: Annotated[dict, Depends(verify_token)]): | |
| return model_object.get_video_inference(payload) |