Update app.py
Browse files
app.py
CHANGED
|
@@ -28,7 +28,7 @@ torch.hub.download_url_to_file(
|
|
| 28 |
|
| 29 |
def generate_caption_git(image_path: str, return_job: bool = False) -> str | Job:
|
| 30 |
try:
|
| 31 |
-
client = Client("
|
| 32 |
fn = client.submit if return_job else client.predict
|
| 33 |
return fn(image_path, api_name="/caption")
|
| 34 |
except Exception:
|
|
@@ -38,7 +38,7 @@ def generate_caption_git(image_path: str, return_job: bool = False) -> str | Job
|
|
| 38 |
|
| 39 |
def generate_caption_blip(image_path: str, return_job: bool = False) -> str | Job:
|
| 40 |
try:
|
| 41 |
-
client = Client("
|
| 42 |
fn = client.submit if return_job else client.predict
|
| 43 |
return fn(image_path, "A picture of", api_name="/caption")
|
| 44 |
except Exception:
|
|
@@ -86,7 +86,7 @@ def generate_caption_blip2_t5xxl(image_path: str, return_job: bool = False) -> s
|
|
| 86 |
|
| 87 |
def generate_caption_instructblip(image_path: str, return_job: bool = False) -> str | Job:
|
| 88 |
try:
|
| 89 |
-
client = Client("
|
| 90 |
fn = client.submit if return_job else client.predict
|
| 91 |
return fn(
|
| 92 |
image_path,
|
|
|
|
| 28 |
|
| 29 |
def generate_caption_git(image_path: str, return_job: bool = False) -> str | Job:
|
| 30 |
try:
|
| 31 |
+
client = Client("hysts/image-captioning-with-git")
|
| 32 |
fn = client.submit if return_job else client.predict
|
| 33 |
return fn(image_path, api_name="/caption")
|
| 34 |
except Exception:
|
|
|
|
| 38 |
|
| 39 |
def generate_caption_blip(image_path: str, return_job: bool = False) -> str | Job:
|
| 40 |
try:
|
| 41 |
+
client = Client("hysts/image-captioning-with-blip")
|
| 42 |
fn = client.submit if return_job else client.predict
|
| 43 |
return fn(image_path, "A picture of", api_name="/caption")
|
| 44 |
except Exception:
|
|
|
|
| 86 |
|
| 87 |
def generate_caption_instructblip(image_path: str, return_job: bool = False) -> str | Job:
|
| 88 |
try:
|
| 89 |
+
client = Client("hysts/InstructBLIP")
|
| 90 |
fn = client.submit if return_job else client.predict
|
| 91 |
return fn(
|
| 92 |
image_path,
|