ford442 commited on
Commit
5f3c82e
·
verified ·
1 Parent(s): 1b05ecd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -16
app.py CHANGED
@@ -37,7 +37,7 @@ examples = [
37
  ]
38
 
39
  MODEL_OPTIONS = {
40
- "REALVISXL V5.0": "SG161222/RealVisXL_V5.0",
41
  "REALVISXL V5.0 BF16": "ford442/RealVisXL_V5.0_BF16",
42
  }
43
 
@@ -87,17 +87,17 @@ def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str
87
 
88
  def load_and_prepare_model(model_id):
89
  model_dtypes = {
90
- "SG161222/RealVisXL_V5.0": torch.float32,
91
  "ford442/RealVisXL_V5.0_BF16": torch.bfloat16,
92
  }
93
 
94
  # Get the dtype based on the model_id
95
- dtype = model_dtypes.get(model_id, torch.float32) # Default to float32 if not found
96
 
97
  # Load the pipeline with the determined dtype
98
  pipe = StableDiffusionXLPipeline.from_pretrained(
99
  model_id,
100
- torch_dtype=dtype if torch.cuda.is_available() else torch.float32,
101
  use_safetensors=True,
102
  add_watermarker=False,
103
  ).to(device)
@@ -357,19 +357,9 @@ with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
357
  </div>
358
  """)
359
 
360
- tokenizer = AutoTokenizer.from_pretrained("HuggingFaceH4/zephyr-7b-beta")
361
- model = AutoModelForCausalLM.from_pretrained("HuggingFaceH4/zephyr-7b-beta")
362
-
363
  def text_generation(input_text, seed):
364
- full_prompt = f"""
365
- Create a detailed and descriptive scene setting for an image based on the following prompt: {input_text}
366
- Your scene:
367
- """
368
- input_ids = tokenizer(full_prompt, return_tensors="pt").input_ids
369
- torch.manual_seed(seed)
370
- outputs = model.generate(input_ids, do_sample=True, min_length=100, max_length=300)
371
- generated_text = tokenizer.batch_decode(outputs, skip_special_tokens=True)
372
- return generated_text
373
 
374
  title = "Text Generator Demo GPT-Neo"
375
  description = "Text Generator Application by ecarbo"
 
37
  ]
38
 
39
  MODEL_OPTIONS = {
40
+ # "REALVISXL V5.0": "SG161222/RealVisXL_V5.0",
41
  "REALVISXL V5.0 BF16": "ford442/RealVisXL_V5.0_BF16",
42
  }
43
 
 
87
 
88
  def load_and_prepare_model(model_id):
89
  model_dtypes = {
90
+ #"SG161222/RealVisXL_V5.0": torch.float32,
91
  "ford442/RealVisXL_V5.0_BF16": torch.bfloat16,
92
  }
93
 
94
  # Get the dtype based on the model_id
95
+ dtype = model_dtypes.get(model_id, torch.bfloat16) # Default to float32 if not found
96
 
97
  # Load the pipeline with the determined dtype
98
  pipe = StableDiffusionXLPipeline.from_pretrained(
99
  model_id,
100
+ torch_dtype=torch.bfloat16,
101
  use_safetensors=True,
102
  add_watermarker=False,
103
  ).to(device)
 
357
  </div>
358
  """)
359
 
 
 
 
360
  def text_generation(input_text, seed):
361
+ full_prompt = "Text Generator Application by ecarbo"
362
+ return full_prompt
 
 
 
 
 
 
 
363
 
364
  title = "Text Generator Demo GPT-Neo"
365
  description = "Text Generator Application by ecarbo"