Spaces:
Running
Running
Update app.py
Browse files
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
|
| 11 |
"""
|
| 12 |
fuyu_result = fuyu_client.predict(
|
| 13 |
image_in, # str representing input in 'raw_image' Image component
|
|
@@ -98,7 +98,7 @@ instruction = f"""
|
|
| 98 |
"""
|
| 99 |
|
| 100 |
def infer(image_in):
|
| 101 |
-
gr.Info("Getting image caption with
|
| 102 |
user_prompt = get_caption(image_in)
|
| 103 |
|
| 104 |
prompt = f"{instruction.strip()}\n{user_prompt}</s>"
|
|
@@ -143,7 +143,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 143 |
submit_btn = gr.Button("Make LLM system from my pic !")
|
| 144 |
with gr.Column():
|
| 145 |
caption = gr.Textbox(
|
| 146 |
-
label = "Image caption (
|
| 147 |
elem_id = "image-caption"
|
| 148 |
)
|
| 149 |
result = gr.Textbox(
|
|
|
|
| 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
|
|
|
|
| 98 |
"""
|
| 99 |
|
| 100 |
def infer(image_in):
|
| 101 |
+
gr.Info("Getting image caption with Kosmos2...")
|
| 102 |
user_prompt = get_caption(image_in)
|
| 103 |
|
| 104 |
prompt = f"{instruction.strip()}\n{user_prompt}</s>"
|
|
|
|
| 143 |
submit_btn = gr.Button("Make LLM system from my pic !")
|
| 144 |
with gr.Column():
|
| 145 |
caption = gr.Textbox(
|
| 146 |
+
label = "Image caption (Kosmos2)",
|
| 147 |
elem_id = "image-caption"
|
| 148 |
)
|
| 149 |
result = gr.Textbox(
|