File size: 1,502 Bytes
18b083a
3e478f7
18b083a
 
7cccb39
18b083a
 
 
 
 
 
 
 
 
d1b3dae
 
 
 
 
 
1b3417a
 
 
d1b3dae
7cccb39
1b3417a
 
 
 
 
 
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
from gradio_client import Client
import gradio as gr
client = Client("https://omnibus-html-image-current-tab.hf.space/--replicas/o0seq/")

def get_screenshot(chat,height=5000,width=600,chatblock=[1],header=True,theme="light",wait=3000):
    result = client.predict(chat,height,width,chatblock,header,theme,wait,api_name="/run_script")
		# str  in 'Chat: [('user','bot'),('user','bot')]' Textbox component
		# float  in 'Height' Number component
		# float  in 'Width' Number component
		# List[Literal['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20']]  in 'Chatblocks' Checkboxgroup component
		# bool  in 'Show Header' Checkbox component
		# Literal['light', 'dark']  in 'Theme' Radio component
		# float (numeric value between 1 and 10000) in 'Wait time' Slider component
		# api_name="/run_script"

        ## return types:
        # filepath representing output in 'value_25' Image component,
        # str representing output in 'value_20' Html component,
        # List[Dict(image: filepath, caption: str | None)] representing output in 'value_24' Gallery component,
        # filepath representing output in 'value_23' Image component,
    out = f'https://omnibus-html-image-current-tab.hf.space/file={result[0]}'
    print(out)
    return out


get_screenshot(chat=[('user','bot'),('user','bot')])
with gr.Blocks() as app:
    img=gr.Image()
    chat=[('user','bot'),('user','bot')]
    app.load(get_screenshot,chat,img)
app.launch()