Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ from transformers import pipeline
|
|
8 |
text_pipe = pipeline('text-generation', model='daspartho/prompt-extend')
|
9 |
|
10 |
def extend_prompt(prompt):
|
11 |
-
return text_pipe(prompt + ',', num_return_sequences=1)[0]["generated_text"]
|
12 |
|
13 |
@st.cache_resource
|
14 |
def load_pipeline(use_cuda):
|
@@ -26,9 +26,9 @@ def load_pipeline(use_cuda):
|
|
26 |
|
27 |
def generate_image(prompt, use_details, steps, seed, use_cuda):
|
28 |
pipe = load_pipeline(use_cuda)
|
29 |
-
generator = torch.manual_seed(seed) if seed != 0 else np.random.
|
30 |
extended_prompt = extend_prompt(prompt) if use_details else prompt
|
31 |
-
image = pipe(prompt=extended_prompt, generator=generator, num_inference_steps=steps, guidance_scale=
|
32 |
return image, extended_prompt
|
33 |
|
34 |
# Custom CSS styling
|
@@ -48,7 +48,7 @@ input_text = st.text_area("Describe your GitHub profile picture:",
|
|
48 |
"Create an anime-style GitHub profile picture for a boy. The character should have a friendly and approachable expression, embodying a sense of curiosity and enthusiasm, reflecting the qualities of a passionate coder. Incorporate elements that suggest technology or coding, such as a pair of stylish glasses, a laptop, or a background with subtle code or tech motifs. Use vibrant and appealing colors to make the profile picture stand out and convey a sense of creativity and innovation.")
|
49 |
|
50 |
details_checkbox = st.checkbox("Generate Details?", value=True)
|
51 |
-
steps_slider = st.slider("Number of Iterations", min_value=1, max_value=
|
52 |
seed_slider = st.slider("Seed", min_value=0, max_value=9007199254740991, value=3982317, step=1)
|
53 |
cuda_checkbox = st.checkbox("Use CUDA?", value=False)
|
54 |
|
|
|
8 |
text_pipe = pipeline('text-generation', model='daspartho/prompt-extend')
|
9 |
|
10 |
def extend_prompt(prompt):
|
11 |
+
return text_pipe(prompt + ',', num_return_sequences=1, max_new_tokens=50)[0]["generated_text"]
|
12 |
|
13 |
@st.cache_resource
|
14 |
def load_pipeline(use_cuda):
|
|
|
26 |
|
27 |
def generate_image(prompt, use_details, steps, seed, use_cuda):
|
28 |
pipe = load_pipeline(use_cuda)
|
29 |
+
generator = torch.manual_seed(seed) if seed != 0 else torch.manual_seed(np.random.randint(0, 2**32))
|
30 |
extended_prompt = extend_prompt(prompt) if use_details else prompt
|
31 |
+
image = pipe(prompt=extended_prompt, generator=generator, num_inference_steps=steps, guidance_scale=7.5).images[0]
|
32 |
return image, extended_prompt
|
33 |
|
34 |
# Custom CSS styling
|
|
|
48 |
"Create an anime-style GitHub profile picture for a boy. The character should have a friendly and approachable expression, embodying a sense of curiosity and enthusiasm, reflecting the qualities of a passionate coder. Incorporate elements that suggest technology or coding, such as a pair of stylish glasses, a laptop, or a background with subtle code or tech motifs. Use vibrant and appealing colors to make the profile picture stand out and convey a sense of creativity and innovation.")
|
49 |
|
50 |
details_checkbox = st.checkbox("Generate Details?", value=True)
|
51 |
+
steps_slider = st.slider("Number of Iterations", min_value=1, max_value=50, value=25, step=1)
|
52 |
seed_slider = st.slider("Seed", min_value=0, max_value=9007199254740991, value=3982317, step=1)
|
53 |
cuda_checkbox = st.checkbox("Use CUDA?", value=False)
|
54 |
|