victor HF Staff commited on
Commit
0d71a12
·
1 Parent(s): 520e2e1

Add error handling for remote text encoder in infer function

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -100,7 +100,10 @@ def infer(
100
 
101
  # Get prompt embeddings from remote text encoder
102
  progress(0.1, desc="Encoding prompt...")
103
- prompt_embeds = remote_text_encoder(prompt).to("cuda")
 
 
 
104
 
105
  # Prepare image list (convert None or empty gallery to None)
106
  image_list = None
@@ -130,7 +133,7 @@ def infer(
130
  css = """
131
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');
132
 
133
- body, .gradio-container {
134
  background-color: #000000 !important;
135
  color: #ffffff !important;
136
  font-family: 'Inter', sans-serif !important;
@@ -138,7 +141,9 @@ body, .gradio-container {
138
  padding: 0 !important;
139
  overflow: hidden !important;
140
  height: 100vh !important;
 
141
  width: 100vw !important;
 
142
  --color-background-primary: #000000;
143
  --color-background-secondary: #050505;
144
  --color-border-primary: #171717;
 
100
 
101
  # Get prompt embeddings from remote text encoder
102
  progress(0.1, desc="Encoding prompt...")
103
+ try:
104
+ prompt_embeds = remote_text_encoder(prompt).to("cuda")
105
+ except Exception as e:
106
+ raise gr.Error(f"Remote text encoder failed: {e}")
107
 
108
  # Prepare image list (convert None or empty gallery to None)
109
  image_list = None
 
133
  css = """
134
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');
135
 
136
+ html, body, .gradio-container {
137
  background-color: #000000 !important;
138
  color: #ffffff !important;
139
  font-family: 'Inter', sans-serif !important;
 
141
  padding: 0 !important;
142
  overflow: hidden !important;
143
  height: 100vh !important;
144
+ max-height: 100vh !important;
145
  width: 100vw !important;
146
+ max-width: 100vw !important;
147
  --color-background-primary: #000000;
148
  --color-background-secondary: #050505;
149
  --color-border-primary: #171717;