fffiloni commited on
Commit
0a67e21
1 Parent(s): a72a83f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -7,7 +7,7 @@ from gradio_client import Client
7
  #fuyu_client = Client("https://adept-fuyu-8b-demo.hf.space/")
8
  kosmos2_client = Client("https://ydshieh-kosmos-2.hf.space/")
9
 
10
- def get_caption(image_in):
11
  """
12
  fuyu_result = fuyu_client.predict(
13
  image_in, # str representing input in 'raw_image' Image component
@@ -55,6 +55,17 @@ def get_caption(image_in):
55
 
56
  return description
57
 
 
 
 
 
 
 
 
 
 
 
 
58
  import re
59
  import torch
60
  from transformers import pipeline
 
7
  #fuyu_client = Client("https://adept-fuyu-8b-demo.hf.space/")
8
  kosmos2_client = Client("https://ydshieh-kosmos-2.hf.space/")
9
 
10
+ def get_caption_from_kosmos2(image_in):
11
  """
12
  fuyu_result = fuyu_client.predict(
13
  image_in, # str representing input in 'raw_image' Image component
 
55
 
56
  return description
57
 
58
+ def get_caption(image_in):
59
+ client = Client("https://vikhyatk-moondream1.hf.space/")
60
+ result = client.predict(
61
+ image_in, # filepath in 'image' Image component
62
+ "Describe precisely the image.", # str in 'Question' Textbox component
63
+ api_name="/answer_question"
64
+ )
65
+ print(result)
66
+ return result
67
+
68
+
69
  import re
70
  import torch
71
  from transformers import pipeline