finalf0 commited on
Commit
9722d74
1 Parent(s): 461ab18

support spaces

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -1,5 +1,6 @@
1
  #!/usr/bin/env python
2
  # encoding: utf-8
 
3
  import gradio as gr
4
  from PIL import Image
5
  import traceback
@@ -131,7 +132,7 @@ def create_component(params, comp='Slider'):
131
  interactive=True
132
  )
133
 
134
-
135
  def chat(img, msgs, ctx, params=None, vision_hidden_states=None):
136
  default_params = {"num_beams":3, "repetition_penalty": 1.2, "max_new_tokens": 1024}
137
  if params is None:
@@ -253,5 +254,6 @@ with gr.Blocks() as demo:
253
  bt_pic.upload(lambda: None, None, chat_bot, queue=False).then(upload_img, inputs=[bt_pic,chat_bot,app_session], outputs=[chat_bot,app_session])
254
 
255
  # launch
256
- demo.launch(share=False, debug=True, show_api=False, server_port=8080, server_name="0.0.0.0")
 
257
 
 
1
  #!/usr/bin/env python
2
  # encoding: utf-8
3
+ import spaces
4
  import gradio as gr
5
  from PIL import Image
6
  import traceback
 
132
  interactive=True
133
  )
134
 
135
+ @spaces.GPU(duration=120)
136
  def chat(img, msgs, ctx, params=None, vision_hidden_states=None):
137
  default_params = {"num_beams":3, "repetition_penalty": 1.2, "max_new_tokens": 1024}
138
  if params is None:
 
254
  bt_pic.upload(lambda: None, None, chat_bot, queue=False).then(upload_img, inputs=[bt_pic,chat_bot,app_session], outputs=[chat_bot,app_session])
255
 
256
  # launch
257
+ #demo.launch(share=False, debug=True, show_api=False, server_port=8080, server_name="0.0.0.0")
258
+ demo.launch()
259