File size: 1,540 Bytes
18b083a
3e478f7
d0d98e0
18b083a
69afa65
18b083a
 
 
 
 
 
 
 
 
d1b3dae
 
 
 
 
 
1b3417a
 
 
d1b3dae
69afa65
7cccb39
69afa65
1b3417a
69afa65
9a1d5e2
69afa65
 
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
32
33
from gradio_client import Client
import gradio as gr
client = Client("https://omnibus-html-image-current-tab.hf.space/")

def get_screenshot(chat: list,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

chat=[('user','bot'),('user','bot')]

#get_screenshot(chat=[('user','bot'),('user','bot')])
with gr.Blocks() as app:
    inp = gr.Textbox(value=chat)
    img=gr.Image(type='filepath')
    
    app.load(get_screenshot,inp,img)
app.launch()