Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 651049375
Change-Id: Ib6388e3ec084bbc27e6de045e53b216cfa9cda01
  • Loading branch information
maximilianw-google authored and copybara-github committed Jul 10, 2024
1 parent e25c34c commit 5f2d709
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/common/vertex_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from concurrent import futures
import dataclasses
import math
import mimetypes
import multiprocessing
import os
from typing import Optional, cast
Expand Down Expand Up @@ -128,9 +129,8 @@ def _generate_descriptions_from_media(
"""
file_extension = os.path.splitext(media_path)[1].replace('.', '')
file_type = self._get_file_type_from_extension(file_extension)
media_content = generative_models.Part.from_uri(
media_path, f'{file_type}/{file_extension}'
)
mime_type = mimetypes.guess_type(media_path)[0]
media_content = generative_models.Part.from_uri(media_path, mime_type)
response = self._text_generation_client.generate_content(
contents=[media_content, getattr(Prompt, file_type.upper())],
stream=False,
Expand Down
1 change: 1 addition & 0 deletions api/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ pg8000
pgvector
gspread
tenacity
mimetype
16 changes: 16 additions & 0 deletions api/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ cachetools==5.3.2 \
--hash=sha256:086ee420196f7b2ab9ca2db2520aca326318b68fe5ba8bc4d49cca91add450f2 \
--hash=sha256:861f35a13a451f94e301ce2bec7cac63e881232ccce7ed67fab9b5df4d3beaa1
# via google-auth
cassidy==0.1.4 \
--hash=sha256:9e6fdfff81accd7766f9b3e6665a1c0a914fd7b23c6da16d9face886bc1fb7d8 \
--hash=sha256:d51a0f4210a614f6b092e25fe29c981de0d9b769c42129b43708e8f847e22bee
# via enumb
certifi==2023.11.17 \
--hash=sha256:9b469f3a900bf28dc19b8cfbf8019bf47f7fdd1a65a1d4ffb98fc14166beb4d1 \
--hash=sha256:e036ab49d5b79556f99cfc2d9320b34cfbe5be05c5871b51de9329f0603b0474
Expand Down Expand Up @@ -144,6 +148,14 @@ docstring-parser==0.16 \
--hash=sha256:538beabd0af1e2db0146b6bd3caa526c35a34d61af9fd2887f3a8a27a739aa6e \
--hash=sha256:bf0a1387354d3691d102edef7ec124f219ef639982d096e26e3b60aeffa90637
# via google-cloud-aiplatform
enumb==0.1.5 \
--hash=sha256:02a6eda94322ae06a52754e46be6d89310b21e0751a9fc5c9546e977b4fa1884 \
--hash=sha256:1fd798bc347eecb598de9f95bc71cedd96baea3d4ad95601bfc9e18700b1e097
# via mimetype
expo==0.1.2 \
--hash=sha256:a36d64c6954de353ee67491351362b04c1b3281acb69afa8534b41279ecd2306 \
--hash=sha256:df9042d9d73307bf987e89791b6e36744c5fa99f7464210e956e76d7fe3e84bd
# via enumb
fastapi==0.105.0 \
--hash=sha256:4d12838819aa52af244580675825e750ad67c9df4614f557a769606af902cf22 \
--hash=sha256:f19ebf6fdc82a3281d10f2cb4774bdfa90238e3b40af3525a0c09fd08ad1c480
Expand Down Expand Up @@ -443,6 +455,10 @@ idna==3.6 \
# via
# anyio
# requests
mimetype==0.1.5 \
--hash=sha256:0ccae479eb36d3ff0553480e9df7738f2789529e5388560ad364ca06eecaa297 \
--hash=sha256:e59720b6249761acef63b0eca246d3ae43a8d3a04f1964136a02d8a8c08d8cbb
# via -r requirements.in
numpy==1.26.2 \
--hash=sha256:06fa1ed84aa60ea6ef9f91ba57b5ed963c3729534e6e54055fc151fad0423f0a \
--hash=sha256:174a8880739c16c925799c018f3f55b8130c1f7c8e75ab0a6fa9d41cab092fd6 \
Expand Down

0 comments on commit 5f2d709

Please sign in to comment.