mikeee commited on
Commit
36833ea
1 Parent(s): 0e8721c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -27,7 +27,7 @@ has_cuda = torch.cuda.is_available()
27
  if has_cuda:
28
  model = AutoModel.from_pretrained(model_name, trust_remote_code=True).cuda() # 3.92G
29
  else:
30
- model = AutoModel.from_pretrained(model_name, trust_remote_code=True) # .float()
31
 
32
  model = model.eval()
33
 
@@ -113,7 +113,7 @@ with gr.Blocks() as demo:
113
  submitBtn = gr.Button("Submit", variant="primary")
114
  with gr.Column(scale=1):
115
  emptyBtn = gr.Button("Clear History")
116
- max_length = gr.Slider(0, 32768, value=8192, step=1.0, label="Maximum length", interactive=True)
117
  top_p = gr.Slider(0, 1, value=0.8, step=0.01, label="Top P", interactive=True)
118
  temperature = gr.Slider(0, 1, value=0.95, step=0.01, label="Temperature", interactive=True)
119
 
@@ -121,7 +121,7 @@ with gr.Blocks() as demo:
121
  past_key_values = gr.State(None)
122
 
123
  submitBtn.click(predict, [user_input, chatbot, max_length, top_p, temperature, history, past_key_values],
124
- [chatbot, history, past_key_values], show_progress=True)
125
  submitBtn.click(reset_user_input, [], [user_input])
126
 
127
  emptyBtn.click(reset_state, outputs=[chatbot, history, past_key_values], show_progress=True)
 
27
  if has_cuda:
28
  model = AutoModel.from_pretrained(model_name, trust_remote_code=True).cuda() # 3.92G
29
  else:
30
+ model = AutoModel.from_pretrained(model_name, trust_remote_code=True).float() # .float()
31
 
32
  model = model.eval()
33
 
 
113
  submitBtn = gr.Button("Submit", variant="primary")
114
  with gr.Column(scale=1):
115
  emptyBtn = gr.Button("Clear History")
116
+ max_length = gr.Slider(0, 32768, value=8192/2, step=1.0, label="Maximum length", interactive=True)
117
  top_p = gr.Slider(0, 1, value=0.8, step=0.01, label="Top P", interactive=True)
118
  temperature = gr.Slider(0, 1, value=0.95, step=0.01, label="Temperature", interactive=True)
119
 
 
121
  past_key_values = gr.State(None)
122
 
123
  submitBtn.click(predict, [user_input, chatbot, max_length, top_p, temperature, history, past_key_values],
124
+ [chatbot, history, past_key_values], show_progress=True, api_name="predict")
125
  submitBtn.click(reset_user_input, [], [user_input])
126
 
127
  emptyBtn.click(reset_state, outputs=[chatbot, history, past_key_values], show_progress=True)