Spaces:
Running
Running
server.py
DELETED
@@ -1,57 +0,0 @@
|
|
1 |
-
import uvicorn
|
2 |
-
import os
|
3 |
-
import requests
|
4 |
-
import json
|
5 |
-
import base64
|
6 |
-
import re
|
7 |
-
import logging
|
8 |
-
from pydantic import BaseModel
|
9 |
-
from typing import Union, Annotated, Optional, List, Dict, Any
|
10 |
-
from base64 import b64decode
|
11 |
-
|
12 |
-
from fastapi import FastAPI, Depends, HTTPException, status, UploadFile, File, Response, Request, Header
|
13 |
-
from fastapi.staticfiles import StaticFiles
|
14 |
-
from fastapi.responses import FileResponse
|
15 |
-
import nest_asyncio
|
16 |
-
|
17 |
-
logging.basicConfig(level=logging.ERROR)
|
18 |
-
|
19 |
-
app = FastAPI(
|
20 |
-
title="TikTok",
|
21 |
-
version="1.0.0",
|
22 |
-
contact={
|
23 |
-
"name": "RendyDev",
|
24 |
-
"url": "https://github.com/TeamKillerX/RyuzakiLib/",
|
25 |
-
},
|
26 |
-
docs_url=None, redoc_url="/"
|
27 |
-
)
|
28 |
-
|
29 |
-
class SuccessResponse(BaseModel):
|
30 |
-
status: str
|
31 |
-
rootx: Dict[str, Any]
|
32 |
-
|
33 |
-
class ErrorResponse(BaseModel):
|
34 |
-
status: str
|
35 |
-
detail: str
|
36 |
-
|
37 |
-
class ErrorStatus(BaseModel):
|
38 |
-
status: str
|
39 |
-
message: str
|
40 |
-
|
41 |
-
class ChatBots(BaseModel):
|
42 |
-
query: str
|
43 |
-
user_id: Optional[int] = None
|
44 |
-
bot_name: Optional[str] = None
|
45 |
-
bot_username: Optional[str] = None
|
46 |
-
|
47 |
-
class TranslateCustom(BaseModel):
|
48 |
-
text: str
|
49 |
-
setlang: str
|
50 |
-
|
51 |
-
@app.get("/status")
|
52 |
-
def status():
|
53 |
-
return {"message": "running"}
|
54 |
-
|
55 |
-
if __name__ == "__main__":
|
56 |
-
nest_asyncio.apply()
|
57 |
-
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|