JadenFK commited on
Commit
506badf
1 Parent(s): 98bb9c3

public demo warning

Browse files
Files changed (1) hide show
  1. app.py +14 -5
app.py CHANGED
@@ -2,12 +2,8 @@ import gradio as gr
2
  import torch
3
  from finetuning import FineTunedModel
4
  from StableDiffuser import StableDiffuser
5
- from tqdm import tqdm
6
  from train import train
7
-
8
- #import os
9
- #os.system("nvidia-smi topo -m")
10
-
11
  model_map = {'Van Gogh' : 'models/vangogh.pt',
12
  'Pablo Picasso': 'models/pablopicasso.pt',
13
  'Car' : 'models/car.pt',
@@ -19,6 +15,13 @@ model_map = {'Van Gogh' : 'models/vangogh.pt',
19
  'Kelly McKernan': 'models/kellymckernan.pt',
20
  'Rembrandt': 'models/rembrandt.pt' }
21
 
 
 
 
 
 
 
 
22
 
23
  class Demo:
24
 
@@ -36,6 +39,12 @@ class Demo:
36
 
37
  def layout(self):
38
 
 
 
 
 
 
 
39
  with gr.Row():
40
 
41
  with gr.Tab("Test") as inference_column:
 
2
  import torch
3
  from finetuning import FineTunedModel
4
  from StableDiffuser import StableDiffuser
 
5
  from train import train
6
+ import os
 
 
 
7
  model_map = {'Van Gogh' : 'models/vangogh.pt',
8
  'Pablo Picasso': 'models/pablopicasso.pt',
9
  'Car' : 'models/car.pt',
 
15
  'Kelly McKernan': 'models/kellymckernan.pt',
16
  'Rembrandt': 'models/rembrandt.pt' }
17
 
18
+ ORIGINAL_SPACE_ID = 'baulab/Erasing-Concepts-In-Diffusion'
19
+ SPACE_ID = os.getenv('SPACE_ID')
20
+
21
+ SHARED_UI_WARNING = f'''## Attention - Training using the ESD-u method does not work in this shard UI. You can either duplicate and use it with a gpu with at least 40GB, or clone this repository to run on your own machine.
22
+ <center><a class="duplicate-button" style="display:inline-block" target="_blank" href="https://huggingface.co/spaces/{SPACE_ID}?duplicate=true"><img style="margin-top:0;margin-bottom:0" src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a></center>
23
+ '''
24
+
25
 
26
  class Demo:
27
 
 
39
 
40
  def layout(self):
41
 
42
+ with gr.Row():
43
+
44
+ if SPACE_ID == ORIGINAL_SPACE_ID:
45
+
46
+ self.warning = gr.Markdown(SHARED_UI_WARNING)
47
+
48
  with gr.Row():
49
 
50
  with gr.Tab("Test") as inference_column: