Spaces:
Running
Running
| import uvicorn | |
| import os | |
| import requests | |
| import json | |
| import base64 | |
| import re | |
| import logging | |
| from pydantic import BaseModel | |
| from typing import Union, Annotated, Optional, List, Dict, Any | |
| from base64 import b64decode | |
| from gpytranslate import SyncTranslator | |
| from fastapi import FastAPI, Depends, HTTPException, status, UploadFile, File, Response, Request, Header | |
| from fastapi.staticfiles import StaticFiles | |
| from fastapi.responses import FileResponse | |
| import nest_asyncio | |
| logging.basicConfig(level=logging.ERROR) | |
| app = FastAPI( | |
| title="TikTok", | |
| version="1.0.0", | |
| contact={ | |
| "name": "RendyDev", | |
| "url": "https://github.com/TeamKillerX/RyuzakiLib/", | |
| }, | |
| docs_url=None, redoc_url="/" | |
| ) | |
| class SuccessResponse(BaseModel): | |
| status: str | |
| rootx: Dict[str, Any] | |
| class ErrorResponse(BaseModel): | |
| status: str | |
| detail: str | |
| class ErrorStatus(BaseModel): | |
| status: str | |
| message: str | |
| class ChatBots(BaseModel): | |
| query: str | |
| user_id: Optional[int] = None | |
| bot_name: Optional[str] = None | |
| bot_username: Optional[str] = None | |
| class TranslateCustom(BaseModel): | |
| text: str | |
| setlang: str | |
| def status(): | |
| return {"message": "running"} | |
| if __name__ == "__main__": | |
| nest_asyncio.apply() | |
| uvicorn.run(app, host="0.0.0.0", port=7860) |