File size: 1,758 Bytes
165189d
 
 
627d59b
165189d
1fb1e3b
 
 
b18ef1e
0db099e
165189d
f1c8dde
73ea45e
f1c8dde
165189d
27c0f8e
1fb1e3b
70b499c
b458243
70b499c
b458243
 
27c0f8e
a3fed0c
 
73ea45e
a3fed0c
 
b18ef1e
f1c8dde
 
 
 
 
 
27c0f8e
 
17f5b16
27c0f8e
 
 
 
165189d
 
27c0f8e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import os
import base64
import time
import io
import gradio as gr
from fastmcp import Client
from fastmcp.client import StreamableHttpTransport 
import asyncio
from dotenv import load_dotenv
import ast # Import the Abstract Syntax Tree module

# ... (imports and global variables remain the same) ...

# ... (process_webcam_stream_async function remains the same) ...

with gr.Blocks() as demo:
    gr.Markdown("## πŸŽ₯ Robot Vision Webcam Stream (using MCP Client)")
    gr.Markdown("""   
    ### πŸ”‘ Hugging Face Token Required
    To use this application, you must set a valid **Hugging Face API Token** in your local environment variables: `HF_TOKEN`.
    **A write token is required** to upload images to the public dataset associated with this space. The resource usage for VLM inference will be tracked against *your* account.
    """)
    with gr.Row():
        webcam_input = gr.Image(
            label="Captured from Web-Cam",
            sources=["upload", "webcam"],
            type="pil"
        )
        with gr.Column():
            # --- πŸ‘‡ INCREASED 'lines' PARAMETER HERE πŸ‘‡ ---
            description_out = gr.Textbox(label="Description", lines=5) # Made larger
            human_out = gr.Textbox(label="Human", lines=3)             # Made larger
            objects_out = gr.Textbox(label="Objects", lines=2)         # Made larger
            environment_out = gr.Textbox(label="Environment", lines=3) # Made larger
            # --------------------------------------------------

    webcam_input.stream(
        process_webcam_stream_async,
        inputs=[webcam_input],
        outputs=[description_out, human_out, objects_out, environment_out],
        stream_every=0.5
    )

if __name__ == "__main__":
    demo.launch()