Spaces:
Runtime error
Runtime error
lionelgarnier
commited on
Commit
·
3114c99
1
Parent(s):
c454959
increase length
Browse files
app.py
CHANGED
@@ -21,7 +21,7 @@ MAX_SEED = np.iinfo(np.int32).max
|
|
21 |
MAX_IMAGE_SIZE = 2048
|
22 |
|
23 |
def refine_prompt(prompt):
|
24 |
-
chatbot = pipeline("text-generation", model="mistralai/Mistral-7B-Instruct-v0.3", max_new_tokens=2048,)
|
25 |
messages = [
|
26 |
{"role": "system", "content": "You are a product designer. You will get a basic prompt of product request and you need to imagine a new product design to satisfy that need. Produce an extended description of product front view that will be use by Flux to generate a visual"},
|
27 |
{"role": "user", "content": prompt},
|
@@ -40,7 +40,8 @@ def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, num_in
|
|
40 |
height = height,
|
41 |
num_inference_steps = num_inference_steps,
|
42 |
generator = generator,
|
43 |
-
guidance_scale=0.0
|
|
|
44 |
).images[0]
|
45 |
return image, seed
|
46 |
|
@@ -190,7 +191,7 @@ with gr.Blocks(css=css) as demo:
|
|
190 |
gr.on(
|
191 |
triggers=[run_button.click],
|
192 |
fn = infer,
|
193 |
-
inputs = [
|
194 |
outputs = [result, seed]
|
195 |
)
|
196 |
|
|
|
21 |
MAX_IMAGE_SIZE = 2048
|
22 |
|
23 |
def refine_prompt(prompt):
|
24 |
+
chatbot = pipeline("text-generation", model="mistralai/Mistral-7B-Instruct-v0.3", max_new_tokens=2048, device=device)
|
25 |
messages = [
|
26 |
{"role": "system", "content": "You are a product designer. You will get a basic prompt of product request and you need to imagine a new product design to satisfy that need. Produce an extended description of product front view that will be use by Flux to generate a visual"},
|
27 |
{"role": "user", "content": prompt},
|
|
|
40 |
height = height,
|
41 |
num_inference_steps = num_inference_steps,
|
42 |
generator = generator,
|
43 |
+
guidance_scale=0.0,
|
44 |
+
max_sequence_length=2048
|
45 |
).images[0]
|
46 |
return image, seed
|
47 |
|
|
|
191 |
gr.on(
|
192 |
triggers=[run_button.click],
|
193 |
fn = infer,
|
194 |
+
inputs = [refined_prompt, seed, randomize_seed, width, height, num_inference_steps],
|
195 |
outputs = [result, seed]
|
196 |
)
|
197 |
|