Update main.py
Browse files
main.py
CHANGED
@@ -4,6 +4,7 @@ import requests
|
|
4 |
import uvloop
|
5 |
import aiofiles
|
6 |
import aiohttp
|
|
|
7 |
from bs4 import BeautifulSoup
|
8 |
from akenoai import OldAkenoXToJs
|
9 |
from akenoai.runner import run_fast
|
@@ -106,9 +107,14 @@ async def upload_to_catbox(dl_path: str) -> str:
|
|
106 |
response.raise_for_status()
|
107 |
return (await response.text()).strip()
|
108 |
|
109 |
-
@fast_app.get("/image")
|
110 |
-
async def get_image():
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
""""
|
114 |
@fast_app.on_event("startup")
|
|
|
4 |
import uvloop
|
5 |
import aiofiles
|
6 |
import aiohttp
|
7 |
+
import os
|
8 |
from bs4 import BeautifulSoup
|
9 |
from akenoai import OldAkenoXToJs
|
10 |
from akenoai.runner import run_fast
|
|
|
107 |
response.raise_for_status()
|
108 |
return (await response.text()).strip()
|
109 |
|
110 |
+
@fast_app.get("/image/share/{filename}")
|
111 |
+
async def get_image(filename: str):
|
112 |
+
file_path = f"image/{filename}"
|
113 |
+
|
114 |
+
if not os.path.exists(file_path):
|
115 |
+
return {"error": "File not found"}
|
116 |
+
|
117 |
+
return FileResponse(file_path)
|
118 |
|
119 |
""""
|
120 |
@fast_app.on_event("startup")
|