zR commited on
Commit
b694633
·
1 Parent(s): 995512e

token check

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -27,7 +27,7 @@ class StopOnTokens(StoppingCriteria):
27
  return False
28
 
29
 
30
- @spaces.GPU()
31
  def predict(history, prompt, max_length, top_p, temperature):
32
  stop = StopOnTokens()
33
  messages = []
@@ -79,6 +79,9 @@ with gr.Blocks() as demo:
79
  <a href="https://github.com/THUDM/LongWriter">🌐 Github</a> |
80
  <a href="https://arxiv.org/pdf/2408.07055">📜 arxiv </a>
81
  </div>
 
 
 
82
  """
83
  )
84
  chatbot = gr.Chatbot()
@@ -94,7 +97,7 @@ with gr.Blocks() as demo:
94
  pBtn = gr.Button("Set Prompt")
95
  with gr.Column(scale=1):
96
  emptyBtn = gr.Button("Clear History")
97
- max_length = gr.Slider(0, 10000000, value=10000, step=1.0, label="Maximum length", interactive=True)
98
  top_p = gr.Slider(0, 1, value=0.8, step=0.01, label="Top P", interactive=True)
99
  temperature = gr.Slider(0.01, 1, value=0.6, step=0.01, label="Temperature", interactive=True)
100
 
 
27
  return False
28
 
29
 
30
+ @spaces.GPU(duration=120)
31
  def predict(history, prompt, max_length, top_p, temperature):
32
  stop = StopOnTokens()
33
  messages = []
 
79
  <a href="https://github.com/THUDM/LongWriter">🌐 Github</a> |
80
  <a href="https://arxiv.org/pdf/2408.07055">📜 arxiv </a>
81
  </div>
82
+ <div style="text-align: center; font-size: 15px; font-weight: bold; color: red; margin-bottom: 20px;">
83
+ ⚠️ This is just a basic demo. Due to the scheduling limitations of Zero GPU, the output length is restricted to under 4K. If you wish to experience the full capabilities of the model (output exceeding 10K), please deploy the model yourself. Thank you for your understanding.
84
+ </div>
85
  """
86
  )
87
  chatbot = gr.Chatbot()
 
97
  pBtn = gr.Button("Set Prompt")
98
  with gr.Column(scale=1):
99
  emptyBtn = gr.Button("Clear History")
100
+ max_length = gr.Slider(0, 128000, value=4096, step=1.0, label="Maximum length(Input + Output)", interactive=True)
101
  top_p = gr.Slider(0, 1, value=0.8, step=0.01, label="Top P", interactive=True)
102
  temperature = gr.Slider(0.01, 1, value=0.6, step=0.01, label="Temperature", interactive=True)
103