Spaces:
Sleeping
Sleeping
Size fix
Browse files
app.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1 |
-
|
2 |
-
|
3 |
DEVICE = 'cpu'
|
4 |
|
5 |
import gradio as gr
|
@@ -44,6 +42,7 @@ output_hidden_state = False
|
|
44 |
def predict(
|
45 |
prompt,
|
46 |
im_emb=None,
|
|
|
47 |
):
|
48 |
"""Run a single prediction on the model"""
|
49 |
with torch.no_grad():
|
@@ -158,8 +157,9 @@ def choose(choice, embs, ys, calibrate_prompts):
|
|
158 |
img, embs, ys, calibrate_prompts = next_image(embs, ys, calibrate_prompts)
|
159 |
return img, embs, ys, calibrate_prompts
|
160 |
|
161 |
-
|
162 |
-
|
|
|
163 |
embs = gr.State([])
|
164 |
ys = gr.State([])
|
165 |
calibrate_prompts = gr.State([
|
@@ -201,6 +201,6 @@ with gr.Blocks() as demo:
|
|
201 |
[b4, embs, ys, calibrate_prompts],
|
202 |
[b1, b2, b3, b4, img, embs, ys, calibrate_prompts])
|
203 |
with gr.Row():
|
204 |
-
html = gr.HTML('''<div style='text-align:center; font-size:
|
205 |
|
206 |
demo.launch() # Share your demo with just 1 extra parameter π
|
|
|
|
|
|
|
1 |
DEVICE = 'cpu'
|
2 |
|
3 |
import gradio as gr
|
|
|
42 |
def predict(
|
43 |
prompt,
|
44 |
im_emb=None,
|
45 |
+
progress=gr.Progress(track_tqdm=True)
|
46 |
):
|
47 |
"""Run a single prediction on the model"""
|
48 |
with torch.no_grad():
|
|
|
157 |
img, embs, ys, calibrate_prompts = next_image(embs, ys, calibrate_prompts)
|
158 |
return img, embs, ys, calibrate_prompts
|
159 |
|
160 |
+
css = ".gradio-container{max-width: 700px !important}"
|
161 |
+
print(css)
|
162 |
+
with gr.Blocks(css=css) as demo:
|
163 |
embs = gr.State([])
|
164 |
ys = gr.State([])
|
165 |
calibrate_prompts = gr.State([
|
|
|
201 |
[b4, embs, ys, calibrate_prompts],
|
202 |
[b1, b2, b3, b4, img, embs, ys, calibrate_prompts])
|
203 |
with gr.Row():
|
204 |
+
html = gr.HTML('''<div style='text-align:center; font-size:20px'>You will calibrate for several prompts and then roam.</ div>''')
|
205 |
|
206 |
demo.launch() # Share your demo with just 1 extra parameter π
|