Spaces:
Running
Running
arxivgpt kim
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,14 +3,14 @@ from gradio_client import Client
|
|
| 3 |
|
| 4 |
def get_caption(image_in):
|
| 5 |
client = Client("https://vikhyatk-moondream1.hf.space/")
|
| 6 |
-
|
| 7 |
-
image_in,
|
| 8 |
-
"Describe the image",
|
| 9 |
api_name="/answer_question"
|
| 10 |
)
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
|
| 15 |
def get_lcm(prompt):
|
| 16 |
client = Client("https://latent-consistency-lcm-lora-for-sdxl.hf.space/")
|
|
@@ -28,11 +28,14 @@ def get_lcm(prompt):
|
|
| 28 |
# Process results and possibly call predict multiple times if multiple images are needed
|
| 29 |
print(results)
|
| 30 |
return results # 실제 API 응답에 기반한 반환 구문
|
| 31 |
-
|
| 32 |
def infer(image_in):
|
| 33 |
caption = get_caption(image_in)
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
# Create an Interface object with proper parameters
|
| 38 |
interface = gr.Interface(
|
|
|
|
| 3 |
|
| 4 |
def get_caption(image_in):
|
| 5 |
client = Client("https://vikhyatk-moondream1.hf.space/")
|
| 6 |
+
caption = client.predict(
|
| 7 |
+
image_in, # 'image_in'은 이미지 파일의 경로입니다.
|
| 8 |
+
"Describe the image", # 'Describe the image'는 모델에 제출되는 문장입니다.
|
| 9 |
api_name="/answer_question"
|
| 10 |
)
|
| 11 |
+
print(caption)
|
| 12 |
+
return caption # caption 변수는 이미지 설명 문자열을 담고 있습니다.
|
| 13 |
+
|
| 14 |
|
| 15 |
def get_lcm(prompt):
|
| 16 |
client = Client("https://latent-consistency-lcm-lora-for-sdxl.hf.space/")
|
|
|
|
| 28 |
# Process results and possibly call predict multiple times if multiple images are needed
|
| 29 |
print(results)
|
| 30 |
return results # 실제 API 응답에 기반한 반환 구문
|
| 31 |
+
|
| 32 |
def infer(image_in):
|
| 33 |
caption = get_caption(image_in)
|
| 34 |
+
# 이 부분은 get_lcm 함수가 올바른 이미지를 생성하고 반환하도록 구현해야 합니다.
|
| 35 |
+
# img_var = get_lcm(caption)
|
| 36 |
+
|
| 37 |
+
# 예제에서는 단순히 이미지 경로를 반환하도록 생략합니다.
|
| 38 |
+
return image_in # 실제로는 get_lcm 함수의 결과를 반환해야 합니다.
|
| 39 |
|
| 40 |
# Create an Interface object with proper parameters
|
| 41 |
interface = gr.Interface(
|