getapi commited on
Commit
41eb20c
1 Parent(s): 4597eac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -2,15 +2,20 @@ from asyncio import create_subprocess_shell, gather, sleep
2
  from pathlib import Path
3
  from random import choice
4
  from subprocess import CalledProcessError, PIPE
5
- from typing import Any
6
  from uuid import uuid4
7
 
 
 
8
  from httpx import AsyncClient, HTTPStatusError, RequestError
 
 
9
 
10
  oxipng_bin = Path(__file__).parent / 'oxipng'
11
  oxipng_bin.chmod(0o755)
12
 
13
  tokens = [
 
14
  '7e0ea3da6a73d77003c1abba7f0ea13c',
15
  'bc2e68b5918e5bb59ebca6c05d73daf9',
16
  'fecbfbe0938bcd1df27b7a9be1702cc9',
@@ -124,12 +129,6 @@ async def optimize_and_upload(images_urls: list[str] | str) -> list[str]:
124
  return new_images_urls
125
 
126
 
127
- from fastapi import FastAPI, HTTPException
128
- from fastapi.responses import PlainTextResponse
129
- from pydantic import BaseModel, HttpUrl
130
- from typing import List
131
-
132
-
133
  app = FastAPI()
134
 
135
 
@@ -152,5 +151,4 @@ async def optimize_images_endpoint(image_urls: ImageURLs):
152
 
153
 
154
  if __name__ == "__main__":
155
- from uvicorn import run as uvicorn_run
156
  uvicorn_run(app, host='0.0.0.0', port=7860, timeout_keep_alive=90)
 
2
  from pathlib import Path
3
  from random import choice
4
  from subprocess import CalledProcessError, PIPE
5
+ from typing import Any, List
6
  from uuid import uuid4
7
 
8
+ from fastapi import FastAPI, HTTPException
9
+ from fastapi.responses import PlainTextResponse
10
  from httpx import AsyncClient, HTTPStatusError, RequestError
11
+ from pydantic import BaseModel, HttpUrl
12
+ from uvicorn import run as uvicorn_run
13
 
14
  oxipng_bin = Path(__file__).parent / 'oxipng'
15
  oxipng_bin.chmod(0o755)
16
 
17
  tokens = [
18
+ # мне в общем-то все равно на эти токены
19
  '7e0ea3da6a73d77003c1abba7f0ea13c',
20
  'bc2e68b5918e5bb59ebca6c05d73daf9',
21
  'fecbfbe0938bcd1df27b7a9be1702cc9',
 
129
  return new_images_urls
130
 
131
 
 
 
 
 
 
 
132
  app = FastAPI()
133
 
134
 
 
151
 
152
 
153
  if __name__ == "__main__":
 
154
  uvicorn_run(app, host='0.0.0.0', port=7860, timeout_keep_alive=90)