Spaces:
Running
Running
Upload main.py
Browse files
main.py
CHANGED
@@ -83,6 +83,7 @@ SOURCE_ALPHA_URL = os.environ["SOURCE_ALPHA_URL"]
|
|
83 |
SOURCE_WAIFU_URL = os.environ["SOURCE_WAIFU_URL"]
|
84 |
SOURCE_TIKTOK_WTF_URL = os.environ["SOURCE_TIKTOK_WTF_URL"]
|
85 |
SOURCE_TIKTOK_TECH_URL = os.environ["SOURCE_TIKTOK_TECH_URL"]
|
|
|
86 |
|
87 |
client_mongo = MongoClient(MONGO_URL)
|
88 |
db = client_mongo["tiktokbot"]
|
@@ -381,6 +382,19 @@ async def get_image_unsplash(query: str, size: str="500x500"):
|
|
381 |
|
382 |
return StreamingResponse(BytesIO(response.content), media_type="image/jpeg")
|
383 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
@app.get("/ryuzaki/reverse")
|
385 |
def google_reverse(
|
386 |
engine: str="google_reverse_image",
|
|
|
83 |
SOURCE_WAIFU_URL = os.environ["SOURCE_WAIFU_URL"]
|
84 |
SOURCE_TIKTOK_WTF_URL = os.environ["SOURCE_TIKTOK_WTF_URL"]
|
85 |
SOURCE_TIKTOK_TECH_URL = os.environ["SOURCE_TIKTOK_TECH_URL"]
|
86 |
+
SOURCE_CALLI_GRAPHY_URL = os.environ["SOURCE_CALLI_GRAPHY_URL"]
|
87 |
|
88 |
client_mongo = MongoClient(MONGO_URL)
|
89 |
db = client_mongo["tiktokbot"]
|
|
|
382 |
|
383 |
return StreamingResponse(BytesIO(response.content), media_type="image/jpeg")
|
384 |
|
385 |
+
@app.get("/ryuzaki/calligraphy")
|
386 |
+
async def get_image_calligraphy(query: str):
|
387 |
+
url = SOURCE_CALLI_GRAPHY_URL
|
388 |
+
image_url = f"{url}?style=1&text={query}"
|
389 |
+
|
390 |
+
try:
|
391 |
+
response = requests.get(image_url)
|
392 |
+
response.raise_for_status()
|
393 |
+
except requests.exceptions.RequestException as e:
|
394 |
+
raise HTTPException(status_code=500, detail=f"Error fetching image: {e}")
|
395 |
+
|
396 |
+
return StreamingResponse(BytesIO(response.content), media_type="image/jpeg")
|
397 |
+
|
398 |
@app.get("/ryuzaki/reverse")
|
399 |
def google_reverse(
|
400 |
engine: str="google_reverse_image",
|