Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -222,8 +222,7 @@ def _fmt_vendors(recs, budget):
|
|
| 222 |
lines.append("---\n")
|
| 223 |
return "\n".join(lines) or "_No results._"
|
| 224 |
|
| 225 |
-
def handle_submit(brief, city, season, budget, ev_type, date, venue, guests, notes
|
| 226 |
-
progress(0, desc="Finding vendors …")
|
| 227 |
recs = recommend_vendors(brief, city, season, float(budget))
|
| 228 |
vendor_md = _fmt_vendors(recs, float(budget))
|
| 229 |
|
|
@@ -243,12 +242,10 @@ def handle_submit(brief, city, season, budget, ev_type, date, venue, guests, not
|
|
| 243 |
selected[cat] = name
|
| 244 |
targets.append({"name": name, "cat": cat, "specs": sp, "alloc": float(budget) * ALLOC_RATIOS[cat]})
|
| 245 |
|
| 246 |
-
progress(0.3, desc="Generating Run of Show …")
|
| 247 |
ros = gen_run_of_show(ev_type, date, venue, city, int(guests), selected, notes)
|
| 248 |
|
| 249 |
blocks = []
|
| 250 |
-
for
|
| 251 |
-
progress(0.4 + 0.2 * j, desc=f"RFP {j}/3 …")
|
| 252 |
txt = gen_rfp(t["name"], t["cat"], t["specs"], ev_type, date, city, int(guests), t["alloc"], notes)
|
| 253 |
blocks.append(f"{'═'*54}\n RFP — {t['cat'].replace('_',' ').upper()}\n TO : {t['name']}\n{'═'*54}\n\n" + txt + "\n")
|
| 254 |
|
|
@@ -262,6 +259,10 @@ def _qs(idx):
|
|
| 262 |
vm, ros, rfps = handle_submit(b, c, s, bu, et, dt, vn, gs, nt)
|
| 263 |
return b, c, s, bu, et, dt, vn, gs, nt, vm, ros, rfps
|
| 264 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
CSS = """
|
| 266 |
body, .gradio-container { background-color: #FAF7F2 !important; font-family: 'Inter', sans-serif !important; color: #2C1810 !important; }
|
| 267 |
.ps-header { background: linear-gradient(135deg, #3D2314 0%, #7A4E2D 60%, #B8895A 100%); border-radius: 16px; padding: 36px 40px; margin-bottom: 20px; box-shadow: 0 8px 32px rgba(61,35,20,.25); color: white; }
|
|
@@ -272,7 +273,7 @@ body, .gradio-container { background-color: #FAF7F2 !important; font-family: 'In
|
|
| 272 |
.ps-footer { text-align: center; color: #A68B6A; font-size: .78rem; margin-top: 28px; border-top: 1px solid #EDE0CE; padding-top: 14px; }
|
| 273 |
"""
|
| 274 |
|
| 275 |
-
with gr.Blocks(css=CSS,
|
| 276 |
gr.HTML("""<div class="ps-header"><h1>🎯 ProSync AI</h1><p>The Event Producer's Command Center</p></div>""")
|
| 277 |
|
| 278 |
with gr.Row():
|
|
@@ -309,9 +310,9 @@ with gr.Blocks(css=CSS, theme=gr.themes.Base(), title="ProSync AI") as demo:
|
|
| 309 |
_form = [brief, city, season, budget, ev_type, date, venue, guests, notes]
|
| 310 |
|
| 311 |
submit.click(fn=handle_submit, inputs=_in, outputs=_out)
|
| 312 |
-
qs0.click(fn=
|
| 313 |
-
qs1.click(fn=
|
| 314 |
-
qs2.click(fn=
|
| 315 |
|
| 316 |
if __name__ == "__main__":
|
| 317 |
-
demo.launch(
|
|
|
|
| 222 |
lines.append("---\n")
|
| 223 |
return "\n".join(lines) or "_No results._"
|
| 224 |
|
| 225 |
+
def handle_submit(brief, city, season, budget, ev_type, date, venue, guests, notes):
|
|
|
|
| 226 |
recs = recommend_vendors(brief, city, season, float(budget))
|
| 227 |
vendor_md = _fmt_vendors(recs, float(budget))
|
| 228 |
|
|
|
|
| 242 |
selected[cat] = name
|
| 243 |
targets.append({"name": name, "cat": cat, "specs": sp, "alloc": float(budget) * ALLOC_RATIOS[cat]})
|
| 244 |
|
|
|
|
| 245 |
ros = gen_run_of_show(ev_type, date, venue, city, int(guests), selected, notes)
|
| 246 |
|
| 247 |
blocks = []
|
| 248 |
+
for t in sorted(targets, key=lambda x: -x["alloc"])[:3]:
|
|
|
|
| 249 |
txt = gen_rfp(t["name"], t["cat"], t["specs"], ev_type, date, city, int(guests), t["alloc"], notes)
|
| 250 |
blocks.append(f"{'═'*54}\n RFP — {t['cat'].replace('_',' ').upper()}\n TO : {t['name']}\n{'═'*54}\n\n" + txt + "\n")
|
| 251 |
|
|
|
|
| 259 |
vm, ros, rfps = handle_submit(b, c, s, bu, et, dt, vn, gs, nt)
|
| 260 |
return b, c, s, bu, et, dt, vn, gs, nt, vm, ros, rfps
|
| 261 |
|
| 262 |
+
def _qs0(): return _qs(0)
|
| 263 |
+
def _qs1(): return _qs(1)
|
| 264 |
+
def _qs2(): return _qs(2)
|
| 265 |
+
|
| 266 |
CSS = """
|
| 267 |
body, .gradio-container { background-color: #FAF7F2 !important; font-family: 'Inter', sans-serif !important; color: #2C1810 !important; }
|
| 268 |
.ps-header { background: linear-gradient(135deg, #3D2314 0%, #7A4E2D 60%, #B8895A 100%); border-radius: 16px; padding: 36px 40px; margin-bottom: 20px; box-shadow: 0 8px 32px rgba(61,35,20,.25); color: white; }
|
|
|
|
| 273 |
.ps-footer { text-align: center; color: #A68B6A; font-size: .78rem; margin-top: 28px; border-top: 1px solid #EDE0CE; padding-top: 14px; }
|
| 274 |
"""
|
| 275 |
|
| 276 |
+
with gr.Blocks(css=CSS, title="ProSync AI") as demo:
|
| 277 |
gr.HTML("""<div class="ps-header"><h1>🎯 ProSync AI</h1><p>The Event Producer's Command Center</p></div>""")
|
| 278 |
|
| 279 |
with gr.Row():
|
|
|
|
| 310 |
_form = [brief, city, season, budget, ev_type, date, venue, guests, notes]
|
| 311 |
|
| 312 |
submit.click(fn=handle_submit, inputs=_in, outputs=_out)
|
| 313 |
+
qs0.click(fn=_qs0, outputs=_form + _out)
|
| 314 |
+
qs1.click(fn=_qs1, outputs=_form + _out)
|
| 315 |
+
qs2.click(fn=_qs2, outputs=_form + _out)
|
| 316 |
|
| 317 |
if __name__ == "__main__":
|
| 318 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|