mrestrepo commited on
Commit
5ca9e61
·
1 Parent(s): ff123d0

Add auth component

Browse files
Files changed (2) hide show
  1. app.py +6 -2
  2. requirements.txt +2 -1
app.py CHANGED
@@ -2,10 +2,13 @@ import spaces
2
  import gradio as gr
3
  import numpy as np
4
  import random
 
 
5
  from diffusers import AutoPipelineForText2Image
6
  import torch
7
  from huggingface_hub import snapshot_download
8
 
 
9
 
10
  snapshot_download(repo_id="Roomie/xavyy", cache_dir='./')
11
 
@@ -64,7 +67,7 @@ with gr.Blocks(css=css) as demo:
64
 
65
  run_button = gr.Button("Run", scale=0)
66
 
67
- result = gr.Image(label="Result", show_label=False)
68
 
69
  with gr.Accordion("Advanced Settings", open=False):
70
 
@@ -136,4 +139,5 @@ with gr.Blocks(css=css) as demo:
136
  outputs=[result]
137
  )
138
 
139
- demo.queue().launch()
 
 
2
  import gradio as gr
3
  import numpy as np
4
  import random
5
+ import os
6
+ from dotenv import load_dotenv
7
  from diffusers import AutoPipelineForText2Image
8
  import torch
9
  from huggingface_hub import snapshot_download
10
 
11
+ load_dotenv()
12
 
13
  snapshot_download(repo_id="Roomie/xavyy", cache_dir='./')
14
 
 
67
 
68
  run_button = gr.Button("Run", scale=0)
69
 
70
+ result = gr.Image(label="Result", show_label=False)
71
 
72
  with gr.Accordion("Advanced Settings", open=False):
73
 
 
139
  outputs=[result]
140
  )
141
 
142
+ demo.queue().launch(debug=True, auth=(os.environ.get(
143
+ 'SPACE_USERNAME'), os.environ.get('SPACE_PASSWORD')))
requirements.txt CHANGED
@@ -6,4 +6,5 @@ transformers
6
  xformers
7
  sentencepiece
8
  peft
9
- spaces
 
 
6
  xformers
7
  sentencepiece
8
  peft
9
+ spaces
10
+ python-dotenv