Update app.py
Browse files11 unmodified lines121314151617181 unmodified line2021222223242526272829303132116 unmodified lines14915015115215315415515615715815916011 unmodified linesfrom fastapi import FastAPI, HTTPExceptionfrom fastapi.responses import StreamingResponsefrom fastapi.middleware.cors import CORSMiddlewarefrom fastapi.responses import FileResponsefrom pydantic import BaseModelfrom transformers import AutoTokenizer, AutoModelForCausalLM, TextIteratorStreamerfrom threading import Thread1 unmodified line
# Model configurationMODEL_NAME = "Nanbeige/Nanbeige4.1-3B"MAX_LENGTH = 8192MAX_LENGTH = 32768
# Global model and tokenizermodel = Nonetokenizer = None
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
class Message(BaseModel): role: str116 unmodified lines }
@app.get("/index", response_class=FileResponse)async def serve_chat(): """Serve chat.html as index.""" return FileResponse(os.path.join(BASE_DIR, "index.html"))
@app.get("/health")async def health(): """Health check endpoint."""app.py+9-1