Omnibus commited on
Commit
243b86a
·
verified ·
1 Parent(s): f23e055

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -44,8 +44,12 @@ def chat_inf(system_prompt,prompt,history):
44
  history.append((prompt,output))
45
  yield history
46
 
47
- def get_screenshot(chat: list,height=5000,width=600,chatblock=[1],theme="light",wait=3000,header=True):
48
  print(chatblock)
 
 
 
 
49
  result = ss_client.predict(str(chat),height,width,chatblock,header,theme,wait,api_name="/run_script")
50
  # str in 'Chat: [('user','bot'),('user','bot')]' Textbox component
51
  # float in 'Height' Number component
@@ -62,7 +66,7 @@ def get_screenshot(chat: list,height=5000,width=600,chatblock=[1],theme="light",
62
  # List[Dict(image: filepath, caption: str | None)] representing output in 'value_24' Gallery component,
63
  # filepath representing output in 'value_23' Image component,
64
  #out = f'https://omnibus-html-image-current-tab.hf.space/file={result[0]}'
65
- out = f'https://omnibus-html-image-current-tab.hf.space/file={result[3]}'
66
  print(out)
67
  return out
68
 
@@ -91,7 +95,7 @@ with gr.Blocks() as app:
91
  im_width=gr.Number(label="Width",value=500)
92
  wait_time=gr.Number(label="Wait Time",value=3000)
93
  theme=gr.Radio(label="Theme", choices=["light","dark"],value="light")
94
- chatblock=gr.Dropdown(label="Chatblocks",choices=[c for c in range(1,40)],multiselect=True,value=1)
95
 
96
  im_btn=gr.Button("Screenshot")
97
  img=gr.Image(type='filepath')
 
44
  history.append((prompt,output))
45
  yield history
46
 
47
+ def get_screenshot(chat: list,height=5000,width=600,chatblock=[],theme="light",wait=3000,header=True):
48
  print(chatblock)
49
+ tog = 0
50
+ if chatblock:
51
+ tog = 3
52
+
53
  result = ss_client.predict(str(chat),height,width,chatblock,header,theme,wait,api_name="/run_script")
54
  # str in 'Chat: [('user','bot'),('user','bot')]' Textbox component
55
  # float in 'Height' Number component
 
66
  # List[Dict(image: filepath, caption: str | None)] representing output in 'value_24' Gallery component,
67
  # filepath representing output in 'value_23' Image component,
68
  #out = f'https://omnibus-html-image-current-tab.hf.space/file={result[0]}'
69
+ out = f'https://omnibus-html-image-current-tab.hf.space/file={result[tog]}'
70
  print(out)
71
  return out
72
 
 
95
  im_width=gr.Number(label="Width",value=500)
96
  wait_time=gr.Number(label="Wait Time",value=3000)
97
  theme=gr.Radio(label="Theme", choices=["light","dark"],value="light")
98
+ chatblock=gr.Dropdown(label="Chatblocks",choices=[c for c in range(1,40)],multiselect=True)
99
 
100
  im_btn=gr.Button("Screenshot")
101
  img=gr.Image(type='filepath')