Spaces:
Running
Running
arxivgpt kim
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -2,20 +2,16 @@ import gradio as gr
|
|
2 |
from gradio_client import Client
|
3 |
|
4 |
def get_caption(image_in):
|
5 |
-
# Correct indentation before client initialization
|
6 |
client = Client("https://vikhyatk-moondream1.hf.space/")
|
7 |
-
|
8 |
-
# Align the call to 'client.predict' with the line above
|
9 |
-
# Also, the parameter 'prompt' is not defined in 'get_caption'.
|
10 |
-
# It should be 'image_in' to match the function signature.
|
11 |
results = client.predict(
|
12 |
-
image_in, #
|
13 |
-
"Describe the image", #
|
14 |
api_name="/answer_question"
|
15 |
)
|
16 |
-
#
|
17 |
-
|
18 |
-
|
|
|
19 |
|
20 |
def get_lcm(prompt):
|
21 |
client = Client("https://latent-consistency-lcm-lora-for-sdxl.hf.space/")
|
|
|
2 |
from gradio_client import Client
|
3 |
|
4 |
def get_caption(image_in):
|
|
|
5 |
client = Client("https://vikhyatk-moondream1.hf.space/")
|
|
|
|
|
|
|
|
|
6 |
results = client.predict(
|
7 |
+
image_in, # 'image_in'은 이미지 파일의 경로
|
8 |
+
"Describe the image", # 'Describe the image'는 모델에 제출되는 고정 쿼리
|
9 |
api_name="/answer_question"
|
10 |
)
|
11 |
+
# 결과 튜플에서 설명 텍스트만 추출하여 반환
|
12 |
+
caption = results['data'][0]['text'] # API 응답의 구조에 따라 수정될 수 있음
|
13 |
+
print(caption)
|
14 |
+
return caption
|
15 |
|
16 |
def get_lcm(prompt):
|
17 |
client = Client("https://latent-consistency-lcm-lora-for-sdxl.hf.space/")
|