Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,10 +13,9 @@ MAX_SEED = np.iinfo(np.int32).max
|
|
| 13 |
dtype = torch.bfloat16
|
| 14 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 15 |
|
| 16 |
-
|
| 17 |
vlm_pipe = ModularPipeline.from_pretrained("briaai/FIBO-VLM-prompt-to-JSON", trust_remote_code=True).to(device)
|
| 18 |
pipe = BriaFiboPipeline.from_pretrained("briaai/FIBO", trust_remote_code=True, torch_dtype=dtype).to(device)
|
| 19 |
-
pipe.enable_model_cpu_offload()
|
| 20 |
|
| 21 |
@spaces.GPU(duration=300)
|
| 22 |
def infer(
|
|
@@ -70,6 +69,14 @@ css = """
|
|
| 70 |
margin: 0 auto;
|
| 71 |
max-width: 768px;
|
| 72 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
"""
|
| 74 |
|
| 75 |
with gr.Blocks(css=css, theme=gr.themes.Soft(primary_hue="violet")) as demo:
|
|
@@ -85,9 +92,9 @@ with gr.Blocks(css=css, theme=gr.themes.Soft(primary_hue="violet")) as demo:
|
|
| 85 |
with gr.Row():
|
| 86 |
prompt_refine = gr.Textbox(label="Prompt")
|
| 87 |
|
| 88 |
-
submit_btn = gr.Button("Generate")
|
| 89 |
result = gr.Image(label="output")
|
| 90 |
-
with gr.Accordion("Structured Prompt", open=False):
|
| 91 |
prompt_in_json = gr.JSON(label="json structured prompt")
|
| 92 |
with gr.Accordion("Advanced Settings", open=False):
|
| 93 |
with gr.Row():
|
|
|
|
| 13 |
dtype = torch.bfloat16
|
| 14 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 15 |
|
| 16 |
+
|
| 17 |
vlm_pipe = ModularPipeline.from_pretrained("briaai/FIBO-VLM-prompt-to-JSON", trust_remote_code=True).to(device)
|
| 18 |
pipe = BriaFiboPipeline.from_pretrained("briaai/FIBO", trust_remote_code=True, torch_dtype=dtype).to(device)
|
|
|
|
| 19 |
|
| 20 |
@spaces.GPU(duration=300)
|
| 21 |
def infer(
|
|
|
|
| 69 |
margin: 0 auto;
|
| 70 |
max-width: 768px;
|
| 71 |
}
|
| 72 |
+
#col-container button {
|
| 73 |
+
background-color: #b388ff !important; /* light purple */
|
| 74 |
+
color: white !important;
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
#col-container .gr-accordion > div {
|
| 78 |
+
background-color: #ffd6e8 !important; /* light pink */
|
| 79 |
+
}
|
| 80 |
"""
|
| 81 |
|
| 82 |
with gr.Blocks(css=css, theme=gr.themes.Soft(primary_hue="violet")) as demo:
|
|
|
|
| 92 |
with gr.Row():
|
| 93 |
prompt_refine = gr.Textbox(label="Prompt")
|
| 94 |
|
| 95 |
+
submit_btn = gr.Button("Generate", elem_id="submit-btn")
|
| 96 |
result = gr.Image(label="output")
|
| 97 |
+
with gr.Accordion("Structured Prompt", open=False, elem_id="structured-prompt"):
|
| 98 |
prompt_in_json = gr.JSON(label="json structured prompt")
|
| 99 |
with gr.Accordion("Advanced Settings", open=False):
|
| 100 |
with gr.Row():
|