fffiloni commited on
Commit
93e6bc9
1 Parent(s): ef7492c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -3,7 +3,7 @@ from gradio_client import Client
3
  import json
4
  import re
5
 
6
- def get_caption(image_in):
7
  kosmos2_client = Client("https://ydshieh-kosmos-2.hf.space/")
8
 
9
  kosmos2_result = kosmos2_client.predict(
@@ -45,6 +45,16 @@ def get_caption(image_in):
45
 
46
  return truncated_caption
47
 
 
 
 
 
 
 
 
 
 
 
48
  def get_magnet(prompt):
49
  amended_prompt = f"High quality sound effects. {prompt}"
50
  print(amended_prompt)
@@ -101,7 +111,7 @@ with gr.Blocks(css=css) as demo:
101
  Image to SFX
102
  </h2>
103
  <p style="text-align: center;">
104
- Compare MAGNet and AudioLDM2 sound effects generation from image caption (Kosmos2)
105
  </p>
106
  """)
107
 
 
3
  import json
4
  import re
5
 
6
+ def get_caption_from_kosmos(image_in):
7
  kosmos2_client = Client("https://ydshieh-kosmos-2.hf.space/")
8
 
9
  kosmos2_result = kosmos2_client.predict(
 
45
 
46
  return truncated_caption
47
 
48
+ def get_caption(image_in):
49
+ client = Client("https://vikhyatk-moondream1.hf.space/--replicas/ggrds/")
50
+ result = client.predict(
51
+ image_in, # filepath in 'image' Image component
52
+ "Describe precisely the image in one sentence.", # str in 'Question' Textbox component
53
+ api_name="/predict"
54
+ )
55
+ print(result)
56
+ return result
57
+
58
  def get_magnet(prompt):
59
  amended_prompt = f"High quality sound effects. {prompt}"
60
  print(amended_prompt)
 
111
  Image to SFX
112
  </h2>
113
  <p style="text-align: center;">
114
+ Compare MAGNet and AudioLDM2 sound effects generation from image caption.
115
  </p>
116
  """)
117