Spaces:
Sleeping
Sleeping
File size: 711 Bytes
fbebf66 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
from typing import Dict, Any
from fastapi import FastAPI
from src.model.him_model import HIMModel
from src.core.config import HIMConfig
app = FastAPI()
model = HIMModel(HIMConfig())
@app.post("/chat")
async def chat(
message: str,
system_message: str = "You are a friendly Chatbot.",
max_tokens: int = 512,
temperature: float = 0.7,
top_p: float = 0.95
) -> Dict[str, Any]:
input_data = {
"message": message,
"system_message": system_message,
"parameters": {
"max_tokens": max_tokens,
"temperature": temperature,
"top_p": top_p
}
}
response = await model.generate_response(input_data)
return response |