tetrisd commited on
Commit
1dda469
β€’
1 Parent(s): 7bb4cf2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -6,7 +6,6 @@ api.set_access_token(os.environ['HF_SECRET'])
6
 
7
  folder = HfFolder()
8
  folder.save_token(os.environ['HF_SECRET'])
9
-
10
  import math
11
  import time
12
  from threading import Lock
@@ -21,7 +20,7 @@ import torch
21
  from spacy import displacy
22
 
23
  from daam import trace
24
- from daam.utils import set_seed, cached_nlp
25
 
26
 
27
  def dependency(text):
@@ -55,7 +54,8 @@ def get_args():
55
  'v1': 'runwayml/stable-diffusion-v1-5',
56
  'v2-base': 'stabilityai/stable-diffusion-2-base',
57
  'v2-large': 'stabilityai/stable-diffusion-2',
58
- 'v2-1-base': 'stabilityai/stable-diffusion-2-1-base'
 
59
  }
60
 
61
  parser = argparse.ArgumentParser()
@@ -93,7 +93,7 @@ def main():
93
  new_prompt = ' '.join(new_prompt)
94
 
95
  merge_idxs, words = get_tokenizing_mapping(prompt, pipe.tokenizer)
96
- with torch.cuda.amp.autocast(dtype=torch.float16), lock:
97
  try:
98
  plt.close('all')
99
  plt.clf()
@@ -167,10 +167,8 @@ def main():
167
 
168
  with gr.Blocks(css='scrollbar.css') as demo:
169
  md = '''# DAAM: Attention Maps for Interpreting Stable Diffusion
170
- Check out the **new** paper (2022/12/7): [What the DAAM: Interpreting Stable Diffusion Using Cross Attention](http://arxiv.org/abs/2210.04885).
171
  See our (much cleaner) [DAAM codebase](https://github.com/castorini/daam) on GitHub.
172
-
173
- Current model: Stable Diffusion 2.1 base.
174
  '''
175
  gr.Markdown(md)
176
 
@@ -220,7 +218,7 @@ def main():
220
 
221
  while True:
222
  try:
223
- demo.launch()
224
  except OSError:
225
  gr.close_all()
226
  except KeyboardInterrupt:
 
6
 
7
  folder = HfFolder()
8
  folder.save_token(os.environ['HF_SECRET'])
 
9
  import math
10
  import time
11
  from threading import Lock
 
20
  from spacy import displacy
21
 
22
  from daam import trace
23
+ from daam.utils import set_seed, cached_nlp, auto_autocast
24
 
25
 
26
  def dependency(text):
 
54
  'v1': 'runwayml/stable-diffusion-v1-5',
55
  'v2-base': 'stabilityai/stable-diffusion-2-base',
56
  'v2-large': 'stabilityai/stable-diffusion-2',
57
+ 'v2-1-base': 'stabilityai/stable-diffusion-2-1-base',
58
+ 'v2-1-large': 'stabilityai/stable-diffusion-2-1',
59
  }
60
 
61
  parser = argparse.ArgumentParser()
 
93
  new_prompt = ' '.join(new_prompt)
94
 
95
  merge_idxs, words = get_tokenizing_mapping(prompt, pipe.tokenizer)
96
+ with auto_autocast(dtype=torch.float16), lock:
97
  try:
98
  plt.close('all')
99
  plt.clf()
 
167
 
168
  with gr.Blocks(css='scrollbar.css') as demo:
169
  md = '''# DAAM: Attention Maps for Interpreting Stable Diffusion
170
+ Check out the paper: [What the DAAM: Interpreting Stable Diffusion Using Cross Attention](http://arxiv.org/abs/2210.04885).
171
  See our (much cleaner) [DAAM codebase](https://github.com/castorini/daam) on GitHub.
 
 
172
  '''
173
  gr.Markdown(md)
174
 
 
218
 
219
  while True:
220
  try:
221
+ demo.launch(server_name='0.0.0.0', server_port=args.port)
222
  except OSError:
223
  gr.close_all()
224
  except KeyboardInterrupt: