Omnibus commited on
Commit
48a320c
1 Parent(s): 101cc57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -154,10 +154,14 @@ Power: 20
154
  Strength: 24
155
  *******************
156
  '''
157
- def check_rand(inp):
 
 
158
  if inp==True:
159
  return gr.Slider(label="Seed", minimum=1, maximum=99999999999, value=random.randint(1,99999999999))
160
- rand_val=random.randint(1,99999999999)
 
 
161
  with gr.Blocks() as app:
162
  gr.HTML("""<center><h1>Mixtral 8x7B RPG</h1><h3>Role Playing Game Master</h3>""")
163
  with gr.Group():
@@ -169,18 +173,18 @@ with gr.Blocks() as app:
169
  opt=gr.Dropdown(label="Choices",choices=["Start a new game"],allow_custom_value=True, value="Start a new game", interactive=True)
170
  #prompt=gr.Textbox(label = "Prompt", value="Start a new game")
171
  with gr.Column(scale=2):
172
- button=gr.Button()
173
  rand = gr.Checkbox(label="Random", value=False)
174
  seed=gr.Slider(label="Seed", minimum=1, maximum=99999999999, value=rand_val)
175
  #models_dd=gr.Dropdown(choices=[m for m in return_list],interactive=True)
 
176
  with gr.Row():
177
  stop_button=gr.Button("Stop")
178
  clear_btn = gr.Button("Clear")
179
  with gr.Row():
180
  tokens = gr.Slider(label="Max new tokens",value=2096,minimum=0,maximum=1048*10,step=64,interactive=False, visible=False,info="The maximum numbers of new tokens")
181
  with gr.Column(scale=1):
182
- json_out=gr.JSON(value=base_stats)
183
  char_stats=gr.Textbox(value=text_stats)
 
184
  textboxes = []
185
  if opts:
186
  textboxes.clear()
@@ -191,7 +195,7 @@ with gr.Blocks() as app:
191
  #inp_query.change(search_models,inp_query,models_dd)
192
  #test_b=test_btn.click(itt,url,e_box)
193
  clear_btn.click(clear_fn,None,[opt,chatbot])
194
- go=button.click(check_rand,rand,seed).then(generate,[opt,chatbot,tokens,char_stats,seed],[chatbot,char_stats,json_out,opt])
195
  stop_button.click(None,None,None,cancels=[go])
196
  app.launch(show_api=False)
197
 
 
154
  Strength: 24
155
  *******************
156
  '''
157
+ rand_val=random.randint(1,99999999999)
158
+
159
+ def check_rand(inp,val):
160
  if inp==True:
161
  return gr.Slider(label="Seed", minimum=1, maximum=99999999999, value=random.randint(1,99999999999))
162
+ else:
163
+ return gr.Slider(label="Seed", minimum=1, maximum=99999999999, value=int(val))
164
+
165
  with gr.Blocks() as app:
166
  gr.HTML("""<center><h1>Mixtral 8x7B RPG</h1><h3>Role Playing Game Master</h3>""")
167
  with gr.Group():
 
173
  opt=gr.Dropdown(label="Choices",choices=["Start a new game"],allow_custom_value=True, value="Start a new game", interactive=True)
174
  #prompt=gr.Textbox(label = "Prompt", value="Start a new game")
175
  with gr.Column(scale=2):
 
176
  rand = gr.Checkbox(label="Random", value=False)
177
  seed=gr.Slider(label="Seed", minimum=1, maximum=99999999999, value=rand_val)
178
  #models_dd=gr.Dropdown(choices=[m for m in return_list],interactive=True)
179
+ button=gr.Button()
180
  with gr.Row():
181
  stop_button=gr.Button("Stop")
182
  clear_btn = gr.Button("Clear")
183
  with gr.Row():
184
  tokens = gr.Slider(label="Max new tokens",value=2096,minimum=0,maximum=1048*10,step=64,interactive=False, visible=False,info="The maximum numbers of new tokens")
185
  with gr.Column(scale=1):
 
186
  char_stats=gr.Textbox(value=text_stats)
187
+ json_out=gr.JSON()
188
  textboxes = []
189
  if opts:
190
  textboxes.clear()
 
195
  #inp_query.change(search_models,inp_query,models_dd)
196
  #test_b=test_btn.click(itt,url,e_box)
197
  clear_btn.click(clear_fn,None,[opt,chatbot])
198
+ go=button.click(check_rand,[rand,seed],seed).then(generate,[opt,chatbot,tokens,char_stats,seed],[chatbot,char_stats,json_out,opt])
199
  stop_button.click(None,None,None,cancels=[go])
200
  app.launch(show_api=False)
201