Spaces:
Running on Zero
Running on Zero
Sync from Bria-AI/huggingface-demos @ 0063f59
Browse files- app.py +79 -31
- bria_logo.png +0 -0
app.py
CHANGED
|
@@ -765,30 +765,54 @@ def create_camera_3d_component(value=None, imageUrl=None, **kwargs):
|
|
| 765 |
|
| 766 |
# --- UI ---
|
| 767 |
css = """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 768 |
:root {
|
| 769 |
-
--name:
|
| 770 |
-
--primary-50: #
|
| 771 |
-
--primary-100: #
|
| 772 |
-
--primary-200: #
|
| 773 |
-
--primary-300: #
|
| 774 |
-
--primary-400: #
|
| 775 |
-
--primary-500: #
|
| 776 |
-
--primary-600: #
|
| 777 |
-
--primary-700: #
|
| 778 |
-
--primary-800: #
|
| 779 |
-
--primary-900: #
|
| 780 |
-
--primary-950: #
|
| 781 |
-
--secondary-50: #
|
| 782 |
-
--secondary-100: #
|
| 783 |
-
--secondary-200: #
|
| 784 |
-
--secondary-300: #
|
| 785 |
-
--secondary-400: #
|
| 786 |
-
--secondary-500: #
|
| 787 |
-
--secondary-600: #
|
| 788 |
-
--secondary-700: #
|
| 789 |
-
--secondary-800: #
|
| 790 |
-
--secondary-900: #
|
| 791 |
-
--secondary-950: #
|
| 792 |
--neutral-50: #fafaf9;
|
| 793 |
--neutral-100: #f5f5f4;
|
| 794 |
--neutral-200: #e7e5e4;
|
|
@@ -1120,16 +1144,28 @@ def update_dimensions_on_upload(image: Optional[Image.Image]) -> Tuple[int, int]
|
|
| 1120 |
return new_width, new_height
|
| 1121 |
|
| 1122 |
|
| 1123 |
-
|
| 1124 |
-
|
| 1125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1126 |
|
| 1127 |
-
Fibo Edit with Multi-Angle LoRA for precise camera control ✨
|
| 1128 |
-
Control rotation, tilt, and zoom to generate images from any angle 🎥
|
| 1129 |
|
| 1130 |
-
|
| 1131 |
-
|
| 1132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1133 |
|
| 1134 |
with gr.Row():
|
| 1135 |
with gr.Column(scale=1):
|
|
@@ -1345,6 +1381,18 @@ with gr.Blocks() as demo:
|
|
| 1345 |
)
|
| 1346 |
|
| 1347 |
# API endpoints for the two-stage inference process
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1348 |
gr.api(fetch_structured_caption, api_name="fetch_caption")
|
| 1349 |
gr.api(generate_image_from_caption, api_name="generate_image")
|
| 1350 |
|
|
|
|
| 765 |
|
| 766 |
# --- UI ---
|
| 767 |
css = """
|
| 768 |
+
#bria-header {
|
| 769 |
+
display: flex; align-items: center; gap: 18px;
|
| 770 |
+
padding: 20px 24px; margin-bottom: 12px;
|
| 771 |
+
background: linear-gradient(120deg, #ffffff 0%, #f3ecff 100%);
|
| 772 |
+
border: 1px solid rgba(83, 0, 201, 0.12); border-radius: 18px;
|
| 773 |
+
}
|
| 774 |
+
.dark #bria-header { background: linear-gradient(120deg, #1a1330 0%, #241640 100%); border-color: rgba(138, 61, 255, 0.25); }
|
| 775 |
+
#bria-header img { height: 50px; width: auto; }
|
| 776 |
+
#bria-header .title-block h1 { margin: 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; color: #1c0050; }
|
| 777 |
+
.dark #bria-header .title-block h1 { color: #f0eafc; }
|
| 778 |
+
#bria-header .title-block p { margin: 4px 0 0 0; font-size: 0.92rem; color: #6b6580; }
|
| 779 |
+
.dark #bria-header .title-block p { color: #b3abc9; }
|
| 780 |
+
#bria-header .pill {
|
| 781 |
+
display: inline-block; margin-top: 8px; padding: 3px 12px;
|
| 782 |
+
font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
|
| 783 |
+
color: #5300C9; background: rgba(83, 0, 201, 0.09); border-radius: 999px;
|
| 784 |
+
}
|
| 785 |
+
.dark #bria-header .pill { color: #c9a6ff; background: rgba(138, 61, 255, 0.15); }
|
| 786 |
+
#bria-footer { margin-top: 18px; text-align: center; font-size: 0.85rem; color: #6b6580; line-height: 1.7; }
|
| 787 |
+
#bria-footer a { color: #5300C9; text-decoration: none; font-weight: 600; }
|
| 788 |
+
#bria-footer a:hover { text-decoration: underline; }
|
| 789 |
+
.dark #bria-footer { color: #b3abc9; }
|
| 790 |
+
.dark #bria-footer a { color: #c9a6ff; }
|
| 791 |
+
|
| 792 |
:root {
|
| 793 |
+
--name: bria;
|
| 794 |
+
--primary-50: #f3ebff;
|
| 795 |
+
--primary-100: #e4d3ff;
|
| 796 |
+
--primary-200: #c9a6ff;
|
| 797 |
+
--primary-300: #a86bff;
|
| 798 |
+
--primary-400: #8a3dff;
|
| 799 |
+
--primary-500: #5300C9;
|
| 800 |
+
--primary-600: #4700ab;
|
| 801 |
+
--primary-700: #37008a;
|
| 802 |
+
--primary-800: #28006b;
|
| 803 |
+
--primary-900: #1c0050;
|
| 804 |
+
--primary-950: #120038;
|
| 805 |
+
--secondary-50: #f3ebff;
|
| 806 |
+
--secondary-100: #e4d3ff;
|
| 807 |
+
--secondary-200: #c9a6ff;
|
| 808 |
+
--secondary-300: #a86bff;
|
| 809 |
+
--secondary-400: #8a3dff;
|
| 810 |
+
--secondary-500: #5300C9;
|
| 811 |
+
--secondary-600: #4700ab;
|
| 812 |
+
--secondary-700: #37008a;
|
| 813 |
+
--secondary-800: #28006b;
|
| 814 |
+
--secondary-900: #1c0050;
|
| 815 |
+
--secondary-950: #120038;
|
| 816 |
--neutral-50: #fafaf9;
|
| 817 |
--neutral-100: #f5f5f4;
|
| 818 |
--neutral-200: #e7e5e4;
|
|
|
|
| 1144 |
return new_width, new_height
|
| 1145 |
|
| 1146 |
|
| 1147 |
+
def _load_logo():
|
| 1148 |
+
"""Embed the bundled logo as a data URI so the header never depends on an external CDN."""
|
| 1149 |
+
try:
|
| 1150 |
+
with open(os.path.join(os.path.dirname(__file__), "bria_logo.png"), "rb") as f:
|
| 1151 |
+
return "data:image/png;base64," + base64.b64encode(f.read()).decode("utf-8")
|
| 1152 |
+
except Exception:
|
| 1153 |
+
return "https://cdn.sanity.io/images/zppcnj0l/production/d0f4aef10abdcc4bacaebeade789ea8c3e453882-210x132.png"
|
| 1154 |
|
|
|
|
|
|
|
| 1155 |
|
| 1156 |
+
BRIA_LOGO = _load_logo()
|
| 1157 |
+
|
| 1158 |
+
with gr.Blocks() as demo:
|
| 1159 |
+
gr.HTML(f'''
|
| 1160 |
+
<div id="bria-header">
|
| 1161 |
+
<img src="{BRIA_LOGO}" alt="BRIA logo" />
|
| 1162 |
+
<div class="title-block">
|
| 1163 |
+
<h1>Camera Angle Control</h1>
|
| 1164 |
+
<p>Fibo Edit + Multi-Angle LoRA — control rotation, tilt, and zoom to re-shoot any image from a new angle.</p>
|
| 1165 |
+
<span class="pill">Open model · Fibo Edit</span>
|
| 1166 |
+
</div>
|
| 1167 |
+
</div>
|
| 1168 |
+
''')
|
| 1169 |
|
| 1170 |
with gr.Row():
|
| 1171 |
with gr.Column(scale=1):
|
|
|
|
| 1381 |
)
|
| 1382 |
|
| 1383 |
# API endpoints for the two-stage inference process
|
| 1384 |
+
gr.HTML("""
|
| 1385 |
+
<div id="bria-footer">
|
| 1386 |
+
<p>
|
| 1387 |
+
Fibo Edit with the Multi-Angle LoRA, on licensed data.
|
| 1388 |
+
Fine-tuning data by <a href="https://huggingface.co/fal/Qwen-Image-Edit-2511-Multiple-Angles-LoRA" target="_blank">Lovis</a>
|
| 1389 |
+
and 3D-camera UI by <a href="https://huggingface.co/spaces/multimodalart/qwen-image-multiple-angles-3d-camera" target="_blank">Apolinario</a>.<br/>
|
| 1390 |
+
<a href="https://huggingface.co/briaai/FIBO-Edit" target="_blank">Fibo Edit model</a> ·
|
| 1391 |
+
<a href="https://bria.ai" target="_blank">Bria AI</a>
|
| 1392 |
+
</p>
|
| 1393 |
+
</div>
|
| 1394 |
+
""")
|
| 1395 |
+
|
| 1396 |
gr.api(fetch_structured_caption, api_name="fetch_caption")
|
| 1397 |
gr.api(generate_image_from_caption, api_name="generate_image")
|
| 1398 |
|
bria_logo.png
ADDED
|