randydev commited on
Commit
6b9cdf9
1 Parent(s): f6f280b

Update fluxai.py

Browse files
Files changed (1) hide show
  1. fluxai.py +0 -29
fluxai.py CHANGED
@@ -75,35 +75,6 @@ def deduct_tokens_gpt(user_id, amount):
75
  else:
76
  return False
77
 
78
- UPLOAD_DIRECTORY = "./uploads"
79
-
80
- @router.post("/uploadfile/")
81
- async def upload_file(file: UploadFile = File(...)):
82
- try:
83
- ext = file.filename.split(".")[-1]
84
- unique_filename = f"{uuid.uuid4().hex}.{ext}"
85
- file_location = os.path.join(UPLOAD_DIRECTORY, unique_filename)
86
- with open(file_location, "wb") as f:
87
- f.write(await file.read())
88
- return JSONResponse(
89
- status_code=200,
90
- content={"url": f"https://randydev-ryuzaki-api.hf.space/api/v1/uploads/{unique_filename}"}
91
- )
92
- except Exception as e:
93
- return JSONResponse(
94
- status_code=500,
95
- content={"error": str(e)}
96
- )
97
-
98
- @router.get("/uploads/{filename}")
99
- async def serve_file(filename: str):
100
- file_location = os.path.join(UPLOAD_DIRECTORY, filename)
101
- if os.path.exists(file_location):
102
- return FileResponse(file_location)
103
- return JSONResponse(
104
- status_code=404,
105
- content={"error": "File not found"}
106
- )
107
 
108
  @router.post("/akeno/mistralai", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
109
  async def mistralai_(payload: MistralAI):
 
75
  else:
76
  return False
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
  @router.post("/akeno/mistralai", response_model=SuccessResponse, responses={422: {"model": SuccessResponse}})
80
  async def mistralai_(payload: MistralAI):