Nick088 commited on
Commit
ead2968
1 Parent(s): 8caf209

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -22,7 +22,7 @@ def generate(
22
  temperature,
23
  top_p,
24
  top_k,
25
- seed_checkbox,
26
  seed,
27
  model_path="roborovski/superprompt-v1",
28
  dtype="fp16",
@@ -42,10 +42,12 @@ def generate(
42
  input_text = f"{prompt}, {history}"
43
  input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(device)
44
 
45
- if seed_checkbox:
46
  seed = random.randint(1, 100000)
47
  torch.manual_seed(seed)
48
-
 
 
49
  outputs = model.generate(
50
  input_ids,
51
  max_new_tokens=max_new_tokens,
@@ -121,7 +123,7 @@ additional_inputs = [
121
  choices=["fp32", "fp16"],
122
  value="fp16",
123
  label="Model Precision",
124
- info="Select the precision of the model: fp32 or fp16",
125
  ),
126
  ]
127
 
@@ -130,11 +132,11 @@ examples = [
130
  [
131
  "Expand the following prompt to add more detail: A storefront with 'Text to Image' written on it.",
132
  None,
133
- None,
134
- None,
135
- None,
136
- None,
137
- None,
138
  False,
139
  None,
140
  "roborovski/superprompt-v1",
 
22
  temperature,
23
  top_p,
24
  top_k,
25
+ random_seed,
26
  seed,
27
  model_path="roborovski/superprompt-v1",
28
  dtype="fp16",
 
42
  input_text = f"{prompt}, {history}"
43
  input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(device)
44
 
45
+ if random_seed:
46
  seed = random.randint(1, 100000)
47
  torch.manual_seed(seed)
48
+ else:
49
+ torch.manual_seed(seed)
50
+
51
  outputs = model.generate(
52
  input_ids,
53
  max_new_tokens=max_new_tokens,
 
123
  choices=["fp32", "fp16"],
124
  value="fp16",
125
  label="Model Precision",
126
+ info="fp32 is more precised, fp16 is faster and less memory consuming",
127
  ),
128
  ]
129
 
 
132
  [
133
  "Expand the following prompt to add more detail: A storefront with 'Text to Image' written on it.",
134
  None,
135
+ 512,
136
+ 1.2,
137
+ 0.5,
138
+ 1,
139
+ 50,
140
  False,
141
  None,
142
  "roborovski/superprompt-v1",