arxivgpt kim
commited on
Commit
โข
3cb0117
1
Parent(s):
2d07bd4
Update app.py
Browse files
app.py
CHANGED
@@ -80,15 +80,19 @@ def get_caption_from_kosmos(image_in):
|
|
80 |
return truncated_caption
|
81 |
|
82 |
def get_caption(image_in):
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
|
|
|
|
|
|
92 |
|
93 |
def get_magnet(prompt):
|
94 |
amended_prompt = f"{prompt}"
|
|
|
80 |
return truncated_caption
|
81 |
|
82 |
def get_caption(image_in):
|
83 |
+
try:
|
84 |
+
client = Client("https://vikhyatk-moondream1.hf.space/", hf_token=hf_token)
|
85 |
+
result = client.predict(
|
86 |
+
image_in,
|
87 |
+
"Describe precisely the image in one sentence.",
|
88 |
+
api_name="/predict"
|
89 |
+
)
|
90 |
+
print(result)
|
91 |
+
return result
|
92 |
+
except Exception as e:
|
93 |
+
print(f"API ํธ์ถ ์ค ์ค๋ฅ ๋ฐ์: {e}")
|
94 |
+
return "API ํธ์ถ ์คํจ๋ก ์บก์
์ ์์ฑํ ์ ์์ต๋๋ค."
|
95 |
+
|
96 |
|
97 |
def get_magnet(prompt):
|
98 |
amended_prompt = f"{prompt}"
|