Inference.
Browse files
app/api/api_v1/endpoints/openai.py
CHANGED
|
@@ -172,7 +172,12 @@ async def create_collection(
|
|
| 172 |
|
| 173 |
results = requests.get(collection_in.location)
|
| 174 |
pages = convert_from_bytes(results.content, 500, None, 1, 1)
|
| 175 |
-
pages[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
tasks = label_studio_project.import_tasks(tmp_file)
|
| 177 |
os.remove(tmp_file)
|
| 178 |
|
|
|
|
| 172 |
|
| 173 |
results = requests.get(collection_in.location)
|
| 174 |
pages = convert_from_bytes(results.content, 500, None, 1, 1)
|
| 175 |
+
cover = pages[0]
|
| 176 |
+
width, height = cover.size
|
| 177 |
+
target_width = round(width - (width * 0.75))
|
| 178 |
+
target_height = round(height - (height * 0.75))
|
| 179 |
+
cover = cover.resize((target_width, target_height), PIL.Image.ANTIALIAS)
|
| 180 |
+
cover.save(tmp_file, optimize=True, quality=95)
|
| 181 |
tasks = label_studio_project.import_tasks(tmp_file)
|
| 182 |
os.remove(tmp_file)
|
| 183 |
|
docker-compose.yaml
CHANGED
|
@@ -20,14 +20,14 @@ services:
|
|
| 20 |
- pgvector
|
| 21 |
environment:
|
| 22 |
- PYTHON_ENV=development
|
| 23 |
-
- OPENAI_API_KEY=
|
| 24 |
- SENTRY_DSN=${SENTRY_DSN}
|
| 25 |
- POSTGRES_SERVER=pgvector
|
| 26 |
- POSTGRES_USER=docker
|
| 27 |
- POSTGRES_PASSWORD=docker
|
| 28 |
- POSTGRES_DB=langchain
|
| 29 |
- LABEL_STUDIO_URL=http://labelstudio:8080
|
| 30 |
-
- LABEL_STUDIO_API_KEY=
|
| 31 |
- LABEL_STUDIO_PROJECT_ID=2
|
| 32 |
build:
|
| 33 |
context: ./
|
|
|
|
| 20 |
- pgvector
|
| 21 |
environment:
|
| 22 |
- PYTHON_ENV=development
|
| 23 |
+
- OPENAI_API_KEY=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
|
| 24 |
- SENTRY_DSN=${SENTRY_DSN}
|
| 25 |
- POSTGRES_SERVER=pgvector
|
| 26 |
- POSTGRES_USER=docker
|
| 27 |
- POSTGRES_PASSWORD=docker
|
| 28 |
- POSTGRES_DB=langchain
|
| 29 |
- LABEL_STUDIO_URL=http://labelstudio:8080
|
| 30 |
+
- LABEL_STUDIO_API_KEY=62c8a636cde07272e232a5af854fc02d91b77509
|
| 31 |
- LABEL_STUDIO_PROJECT_ID=2
|
| 32 |
build:
|
| 33 |
context: ./
|