arxivgpt kim commited on
Commit
4e9a9f5
·
verified ·
1 Parent(s): ce2ed82

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -10
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, # Use the 'image_in' parameter as input to the model
13
- "Describe the image", # Assuming this is a constant parameter for the model
14
  api_name="/answer_question"
15
  )
16
- # Print and return the results assuming it contains the description
17
- print(results)
18
- return results
 
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/")