Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -29,11 +29,13 @@ date_time_str = now.strftime("%Y-%m-%d %H:%M:%S")
|
|
29 |
#client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
30 |
history = []
|
31 |
|
32 |
-
def gen_from_infer(purpose,history,image,model_drop,chat_drop,choice,seed):
|
33 |
#out_img = infer(out_prompt)
|
34 |
history.clear()
|
35 |
if seed == 0:
|
36 |
seed = random.randint(1,1111111111111111)
|
|
|
|
|
37 |
out_prompt=generate(purpose,history,chat_drop,seed)
|
38 |
history.append((purpose,out_prompt))
|
39 |
yield (history,None)
|
@@ -50,7 +52,7 @@ def gen_from_infer(purpose,history,image,model_drop,chat_drop,choice,seed):
|
|
50 |
num_inference_steps=None,
|
51 |
guidance_scale=None,
|
52 |
model=None,
|
53 |
-
seed=
|
54 |
)
|
55 |
yield (history,out_img)
|
56 |
|
@@ -183,13 +185,17 @@ with gr.Blocks(css=style) as iface:
|
|
183 |
with gr.Row():
|
184 |
agent_choice = gr.Radio(choices=["Generate","Describe"],value="Generate")
|
185 |
msg = gr.Textbox()
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
|
|
|
|
|
|
|
|
193 |
with gr.Group():
|
194 |
with gr.Row():
|
195 |
submit_b = gr.Button()
|
@@ -199,7 +205,7 @@ with gr.Blocks(css=style) as iface:
|
|
199 |
with gr.Column(scale=2):
|
200 |
sumbox=gr.Image(label="Image")
|
201 |
|
202 |
-
run_test = test_btn.click(gen_from_infer, [msg,chatbot,sumbox,model_drop,chat_model_drop,agent_choice,chat_seed],[chatbot,sumbox],concurrency_limit=20)
|
203 |
|
204 |
sub_b = submit_b.click(run, [msg,chatbot,sumbox,model_drop,chat_model_drop,agent_choice,chat_seed],[chatbot,sumbox],concurrency_limit=20)
|
205 |
sub_e = msg.submit(run, [msg, chatbot,sumbox,model_drop,chat_model_drop,agent_choice,chat_seed], [chatbot,sumbox],concurrency_limit=20)
|
|
|
29 |
#client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
30 |
history = []
|
31 |
|
32 |
+
def gen_from_infer(purpose,history,image,model_drop,chat_drop,choice,seed,im_seed):
|
33 |
#out_img = infer(out_prompt)
|
34 |
history.clear()
|
35 |
if seed == 0:
|
36 |
seed = random.randint(1,1111111111111111)
|
37 |
+
if im_seed == 0:
|
38 |
+
im_seed = random.randint(1,1111111111111111)
|
39 |
out_prompt=generate(purpose,history,chat_drop,seed)
|
40 |
history.append((purpose,out_prompt))
|
41 |
yield (history,None)
|
|
|
52 |
num_inference_steps=None,
|
53 |
guidance_scale=None,
|
54 |
model=None,
|
55 |
+
seed=im_seed,
|
56 |
)
|
57 |
yield (history,out_img)
|
58 |
|
|
|
185 |
with gr.Row():
|
186 |
agent_choice = gr.Radio(choices=["Generate","Describe"],value="Generate")
|
187 |
msg = gr.Textbox()
|
188 |
+
with gr.Accordion("Controls", open=False):
|
189 |
+
model_drop=gr.Dropdown(label="Diffusion Models", type="index", choices=[m for m in models], value=models[0])
|
190 |
+
chat_model_drop=gr.Dropdown(label="Chatbot Models", type="index", choices=[m for m in c_models], value=c_models[0])
|
191 |
+
chat_seed=gr.Slider(label="Prompt Seed", minimum=0,maximum=1000000000000,
|
192 |
+
value=random.randint(1,1000000000000),step=1,
|
193 |
+
interactive=True,
|
194 |
+
info="Set Seed to 0 to randomize the session")
|
195 |
+
image_seed=gr.Slider(label="Image Seed", minimum=0,maximum=1000000000000,
|
196 |
+
value=random.randint(1,1000000000000),step=1,
|
197 |
+
interactive=True,
|
198 |
+
info="Set Seed to 0 to randomize the session")
|
199 |
with gr.Group():
|
200 |
with gr.Row():
|
201 |
submit_b = gr.Button()
|
|
|
205 |
with gr.Column(scale=2):
|
206 |
sumbox=gr.Image(label="Image")
|
207 |
|
208 |
+
run_test = test_btn.click(gen_from_infer, [msg,chatbot,sumbox,model_drop,chat_model_drop,agent_choice,chat_seed,image_seed],[chatbot,sumbox],concurrency_limit=20)
|
209 |
|
210 |
sub_b = submit_b.click(run, [msg,chatbot,sumbox,model_drop,chat_model_drop,agent_choice,chat_seed],[chatbot,sumbox],concurrency_limit=20)
|
211 |
sub_e = msg.submit(run, [msg, chatbot,sumbox,model_drop,chat_model_drop,agent_choice,chat_seed], [chatbot,sumbox],concurrency_limit=20)
|