Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,6 @@ model.to(device)
|
|
17 |
|
18 |
|
19 |
def generate(
|
20 |
-
system_prompt,
|
21 |
prompt,
|
22 |
max_new_tokens,
|
23 |
repetition_penalty,
|
@@ -26,8 +25,7 @@ def generate(
|
|
26 |
top_k,
|
27 |
seed
|
28 |
):
|
29 |
-
|
30 |
-
input_text = f"{system_prompt}, {prompt}"
|
31 |
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(device)
|
32 |
|
33 |
if seed == 0:
|
@@ -53,8 +51,6 @@ def generate(
|
|
53 |
|
54 |
prompt = gr.Textbox(label="Prompt", interactive=True)
|
55 |
|
56 |
-
system_prompt = gr.Textbox(label="System Prompt", interactive=True)
|
57 |
-
|
58 |
max_new_tokens = gr.Slider(value=512, minimum=250, maximum=512, step=1, interactive=True, label="Max New Tokens", info="The maximum numbers of new tokens, controls how long is the output")
|
59 |
|
60 |
repetition_penalty = gr.Slider(value=1.2, minimum=0, maximum=2, step=0.05, interactive=True, label="Repetition Penalty", info="Penalize repeated tokens, making the AI repeat less itself")
|
@@ -70,7 +66,6 @@ seed = gr.Number(value=42, interactive=True, label="Seed", info="A starting poin
|
|
70 |
examples = [
|
71 |
[
|
72 |
"A storefront with 'Text to Image' written on it.",
|
73 |
-
"Expand the following prompt to add more detail:",
|
74 |
512,
|
75 |
1.2,
|
76 |
0.5,
|
@@ -82,10 +77,10 @@ examples = [
|
|
82 |
|
83 |
gr.Interface(
|
84 |
fn=generate,
|
85 |
-
inputs=[prompt,
|
86 |
outputs=gr.Textbox(label="Better Prompt"),
|
87 |
title="SuperPrompt-v1",
|
88 |
-
description="Make your prompts more detailed!<br>Model used: https://huggingface.co/roborovski/superprompt-v1<br>Hugging Face Space made by [Nick088](https://linktr.ee/Nick088)",
|
89 |
examples=examples,
|
90 |
concurrency_limit=20,
|
91 |
).launch(show_api=False)
|
|
|
17 |
|
18 |
|
19 |
def generate(
|
|
|
20 |
prompt,
|
21 |
max_new_tokens,
|
22 |
repetition_penalty,
|
|
|
25 |
top_k,
|
26 |
seed
|
27 |
):
|
28 |
+
input_text = f"Expand the following prompt to add more detail: {prompt}"
|
|
|
29 |
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(device)
|
30 |
|
31 |
if seed == 0:
|
|
|
51 |
|
52 |
prompt = gr.Textbox(label="Prompt", interactive=True)
|
53 |
|
|
|
|
|
54 |
max_new_tokens = gr.Slider(value=512, minimum=250, maximum=512, step=1, interactive=True, label="Max New Tokens", info="The maximum numbers of new tokens, controls how long is the output")
|
55 |
|
56 |
repetition_penalty = gr.Slider(value=1.2, minimum=0, maximum=2, step=0.05, interactive=True, label="Repetition Penalty", info="Penalize repeated tokens, making the AI repeat less itself")
|
|
|
66 |
examples = [
|
67 |
[
|
68 |
"A storefront with 'Text to Image' written on it.",
|
|
|
69 |
512,
|
70 |
1.2,
|
71 |
0.5,
|
|
|
77 |
|
78 |
gr.Interface(
|
79 |
fn=generate,
|
80 |
+
inputs=[prompt, max_new_tokens, repetition_penalty, temperature, top_p, top_k, seed],
|
81 |
outputs=gr.Textbox(label="Better Prompt"),
|
82 |
title="SuperPrompt-v1",
|
83 |
+
description="Make your prompts more detailed!<br>Model used: https://huggingface.co/roborovski/superprompt-v1<br>Hugging Face Space made by [Nick088](https://linktr.ee/Nick088) <br> Task Prefix: 'Expand the following prompt to add more detail:' is already setted!",
|
84 |
examples=examples,
|
85 |
concurrency_limit=20,
|
86 |
).launch(show_api=False)
|