randydev Ufoptg commited on
Commit
71643a3
·
verified ·
1 Parent(s): 813d076

Update server.py (#3)

Browse files

- Update server.py (15cc131dc90255c83601cf3a1b77472bdf392eb6)


Co-authored-by: True Saiyan <[email protected]>

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