treadon commited on
Commit
8615850
1 Parent(s): 4d60106

Fix parameters and ENV values

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -7,8 +7,13 @@ import re
7
 
8
  device = "cpu"
9
  is_peft = False
10
- model_id = "treadon/prompt-fungineer-355M"
11
- auth_token = os.environ["HUB_TOKEN"]
 
 
 
 
 
12
 
13
  model = transformers.AutoModelForCausalLM.from_pretrained(model_id, low_cpu_mem_usage=True,use_auth_token=auth_token)
14
  tokenizer = transformers.AutoTokenizer.from_pretrained("gpt2")
@@ -72,9 +77,9 @@ Just enter a basic prompt and the fungineering model will use its wildest imagin
72
  temperature = gr.Slider( minimum=0.1, maximum=1.2, value=0.85, step=0.01, label="Temperature", info="Temperature sampling. Higher values will make the model more creative")
73
 
74
  with gr.Accordion("Advanced Output Settings", open=False):
75
- gr.Checkbox(value=True, label="Enhancers", info="Add image meta information such as lens type, shuffter speed, camera model, etc.")
76
- gr.Checkbox(value=False, label="Inpsiration", info="Include inspirational photographers that are known for this type of photography. Sometimes random people will appear here, needs more training.")
77
- gr.Checkbox(value=False, label="Negative Prompt", info="Include a negative prompt, more often used in Stable Diffusion. If you're a Stable Diffusion user, chances are you already have a better negative prompt you like to use.")
78
 
79
  with gr.Column():
80
  outputs = [
@@ -84,7 +89,7 @@ Just enter a basic prompt and the fungineering model will use its wildest imagin
84
  gr.Textbox(lines=5, label="Fungineered Text 4"),
85
  ]
86
 
87
- inputs = [base_prompt, extra, top_k, top_p, temperature]
88
 
89
 
90
  submit = gr.Button(label="Fungineer",variant="primary")
 
7
 
8
  device = "cpu"
9
  is_peft = False
10
+ model_id = os.environ.get("MODEL_ID") or "treadon/prompt-fungineer-355M"
11
+ auth_token = os.environ.get("HUB_TOKEN") or True
12
+
13
+ print(f"Using model {model_id}.")
14
+
15
+ if auth_token != True:
16
+ print("Using auth token.")
17
 
18
  model = transformers.AutoModelForCausalLM.from_pretrained(model_id, low_cpu_mem_usage=True,use_auth_token=auth_token)
19
  tokenizer = transformers.AutoTokenizer.from_pretrained("gpt2")
 
77
  temperature = gr.Slider( minimum=0.1, maximum=1.2, value=0.85, step=0.01, label="Temperature", info="Temperature sampling. Higher values will make the model more creative")
78
 
79
  with gr.Accordion("Advanced Output Settings", open=False):
80
+ enh = gr.Checkbox(value=True, label="Enhancers", info="Add image meta information such as lens type, shuffter speed, camera model, etc.")
81
+ insp = gr.Checkbox(value=False, label="Inpsiration", info="Include inspirational photographers that are known for this type of photography. Sometimes random people will appear here, needs more training.")
82
+ neg = gr.Checkbox(value=False, label="Negative Prompt", info="Include a negative prompt, more often used in Stable Diffusion. If you're a Stable Diffusion user, chances are you already have a better negative prompt you like to use.")
83
 
84
  with gr.Column():
85
  outputs = [
 
89
  gr.Textbox(lines=5, label="Fungineered Text 4"),
90
  ]
91
 
92
+ inputs = [base_prompt, extra, top_k, top_p, temperature, enh, insp, neg]
93
 
94
 
95
  submit = gr.Button(label="Fungineer",variant="primary")