Spaces:
Running
Running
Upload main.py
Browse files
main.py
CHANGED
@@ -406,29 +406,6 @@ def get_translate(
|
|
406 |
status="True",
|
407 |
randydev={"message": "Error not responding"})
|
408 |
|
409 |
-
@app.get("/ryuzaki/ai", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
410 |
-
def ryuzaki_ai(
|
411 |
-
item: RyuzakiAi,
|
412 |
-
api_key: None = Depends(validate_api_key)
|
413 |
-
):
|
414 |
-
try:
|
415 |
-
response_data = code.ryuzaki_ai_text(item.text)
|
416 |
-
|
417 |
-
if isinstance(response_data, list) and len(response_data) > 0:
|
418 |
-
first_result = response_data[0]
|
419 |
-
if "generated_text" in first_result:
|
420 |
-
message = first_result["generated_text"]
|
421 |
-
return SuccessResponse(
|
422 |
-
status="True",
|
423 |
-
randydev={
|
424 |
-
"ryuzaki_text": message
|
425 |
-
}
|
426 |
-
)
|
427 |
-
return {"status": "false", "message": "Invalid response format"}
|
428 |
-
|
429 |
-
except Exception:
|
430 |
-
return {"status": "false", "message": "Internal server error"}
|
431 |
-
|
432 |
@app.get("/ryuzaki/reverse", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
433 |
def google_reverse(
|
434 |
item: GoogleReverse,
|
@@ -517,6 +494,29 @@ def free_chatgpt4_bing(item: ChatgptCustom):
|
|
517 |
except:
|
518 |
return {"status": "false", "message": "Error response."}
|
519 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
520 |
@app.post("/ryuzaki/opendalle")
|
521 |
def open_dalle(
|
522 |
item: OpenDalle,
|
@@ -628,6 +628,23 @@ def chatgpt_model(item: ChatgptModel):
|
|
628 |
}
|
629 |
)
|
630 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
631 |
@app.post("/ryuzaki/google-ai", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
632 |
def v1beta3_google_ai(
|
633 |
item: ChatgptCustom,
|
|
|
406 |
status="True",
|
407 |
randydev={"message": "Error not responding"})
|
408 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
@app.get("/ryuzaki/reverse", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
410 |
def google_reverse(
|
411 |
item: GoogleReverse,
|
|
|
494 |
except:
|
495 |
return {"status": "false", "message": "Error response."}
|
496 |
|
497 |
+
@app.post("/ryuzaki/ai", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
498 |
+
def ryuzaki_ai(
|
499 |
+
item: RyuzakiAi,
|
500 |
+
api_key: None = Depends(validate_api_key)
|
501 |
+
):
|
502 |
+
try:
|
503 |
+
response_data = code.ryuzaki_ai_text(item.text)
|
504 |
+
|
505 |
+
if isinstance(response_data, list) and len(response_data) > 0:
|
506 |
+
first_result = response_data[0]
|
507 |
+
if "generated_text" in first_result:
|
508 |
+
message = first_result["generated_text"]
|
509 |
+
return SuccessResponse(
|
510 |
+
status="True",
|
511 |
+
randydev={
|
512 |
+
"ryuzaki_text": message
|
513 |
+
}
|
514 |
+
)
|
515 |
+
return {"status": "false", "message": "Invalid response format"}
|
516 |
+
|
517 |
+
except Exception:
|
518 |
+
return {"status": "false", "message": "Internal server error"}
|
519 |
+
|
520 |
@app.post("/ryuzaki/opendalle")
|
521 |
def open_dalle(
|
522 |
item: OpenDalle,
|
|
|
628 |
}
|
629 |
)
|
630 |
|
631 |
+
|
632 |
+
@app.post("/ryuzaki/chatgpt3-turbo", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
633 |
+
def chatgpt3_turbo(item: ChatgptCustom):
|
634 |
+
url = "https://lexica.qewertyy.me/models"
|
635 |
+
params = {"model_id": 5, "prompt": item.query}
|
636 |
+
response = requests.post(url, params=params)
|
637 |
+
if response.status_code != 200:
|
638 |
+
return f"Error status: {response.status_code}"
|
639 |
+
check_response = response.json()
|
640 |
+
answer = check_response.get("content")
|
641 |
+
return SuccessResponse(
|
642 |
+
status="True",
|
643 |
+
randydev={
|
644 |
+
"message": answer
|
645 |
+
}
|
646 |
+
)
|
647 |
+
|
648 |
@app.post("/ryuzaki/google-ai", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
649 |
def v1beta3_google_ai(
|
650 |
item: ChatgptCustom,
|