Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,12 +13,7 @@ import torch
|
|
| 13 |
import gradio as gr
|
| 14 |
from sentence_transformers import SentenceTransformer, util as st_util
|
| 15 |
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
|
| 16 |
-
import spaces
|
| 17 |
|
| 18 |
-
@spaces.GPU
|
| 19 |
-
def dummy_gpu_function():
|
| 20 |
-
pass
|
| 21 |
-
|
| 22 |
warnings.filterwarnings("ignore")
|
| 23 |
|
| 24 |
os.environ["CUDA_VISIBLE_DEVICES"] = ""
|
|
@@ -46,11 +41,14 @@ ALLOC_RATIOS = {
|
|
| 46 |
CITIES = ["Beer Sheva", "Haifa", "Herzliya", "Jerusalem",
|
| 47 |
"Netanya", "Petah Tikva", "Ramat Gan", "Tel Aviv"]
|
| 48 |
SEASONS = ["Winter", "Spring", "Summer", "Fall"]
|
|
|
|
|
|
|
| 49 |
EVENT_TYPES = [
|
| 50 |
-
"Annual Conference", "Award Ceremony", "Brand Activation",
|
| 51 |
-
"Corporate Gala", "Investor Day", "
|
| 52 |
-
"Team Building", "Tech Summit", "Trade Show", "Workshop Series",
|
| 53 |
]
|
|
|
|
| 54 |
QUICK_STARTERS = [
|
| 55 |
{
|
| 56 |
"label": "🏙️ Tech Summit · Tel Aviv",
|
|
@@ -58,7 +56,7 @@ QUICK_STARTERS = [
|
|
| 58 |
"kosher catering for 400 guests, VIP executive security.",
|
| 59 |
"city": "Tel Aviv", "season": "Summer", "budget": 250_000,
|
| 60 |
"type": "Tech Summit", "guests": 400,
|
| 61 |
-
"date": "October 15,
|
| 62 |
"notes": "Kosher catering required. VIP lounge for 30 executives.",
|
| 63 |
},
|
| 64 |
{
|
|
@@ -67,7 +65,7 @@ QUICK_STARTERS = [
|
|
| 67 |
"professional photography and videography for 200 guests.",
|
| 68 |
"city": "Jerusalem", "season": "Winter", "budget": 140_000,
|
| 69 |
"type": "Corporate Gala", "guests": 200,
|
| 70 |
-
"date": "December 5,
|
| 71 |
"notes": "Black-tie dress code. Award presentation segment.",
|
| 72 |
},
|
| 73 |
{
|
|
@@ -76,9 +74,18 @@ QUICK_STARTERS = [
|
|
| 76 |
"logistics, casual catering for 150 employees.",
|
| 77 |
"city": "Haifa", "season": "Spring", "budget": 65_000,
|
| 78 |
"type": "Team Building", "guests": 150,
|
| 79 |
-
"date": "April 22,
|
| 80 |
"notes": "Outdoor venue preferred. Vegetarian options required.",
|
| 81 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
]
|
| 83 |
|
| 84 |
def _to_list(val):
|
|
@@ -202,7 +209,8 @@ def gen_run_of_show(ev_type, date, venue, city, guests, vendors, notes):
|
|
| 202 |
return _call_llm(_prompt("You are a senior event production manager. Write a detailed Run of Show using format HH:MM — Task.", f"Event: {ev_type}\nDate: {date}\nVenue: {venue}, {city}\nGuests: {guests:,}\nNotes: {notes or 'None'}\n\nVendors:\n{lines}"))
|
| 203 |
|
| 204 |
def gen_rfp(name, cat, specs, ev_type, date, city, guests, alloc_usd, notes):
|
| 205 |
-
|
|
|
|
| 206 |
|
| 207 |
def _stars(r):
|
| 208 |
n = min(5, max(0, int(round(float(r)))))
|
|
@@ -267,6 +275,13 @@ def _qs(idx):
|
|
| 267 |
def _qs0(): return _qs(0)
|
| 268 |
def _qs1(): return _qs(1)
|
| 269 |
def _qs2(): return _qs(2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
|
| 271 |
CSS = """
|
| 272 |
body, .gradio-container { background-color: #FAF7F2 !important; font-family: 'Inter', sans-serif !important; color: #2C1810 !important; }
|
|
@@ -285,6 +300,7 @@ with gr.Blocks(css=CSS, title="ProSync AI") as demo:
|
|
| 285 |
qs0 = gr.Button(QUICK_STARTERS[0]["label"], elem_classes=["qs-btn"])
|
| 286 |
qs1 = gr.Button(QUICK_STARTERS[1]["label"], elem_classes=["qs-btn"])
|
| 287 |
qs2 = gr.Button(QUICK_STARTERS[2]["label"], elem_classes=["qs-btn"])
|
|
|
|
| 288 |
|
| 289 |
brief = gr.Textbox(label="Describe your event", lines=4)
|
| 290 |
with gr.Row():
|
|
@@ -296,7 +312,7 @@ with gr.Blocks(css=CSS, title="ProSync AI") as demo:
|
|
| 296 |
ev_type = gr.Dropdown(label="Event Type", choices=EVENT_TYPES, value="Tech Summit")
|
| 297 |
guests = gr.Number(label="Guest Count", value=300)
|
| 298 |
with gr.Row():
|
| 299 |
-
date = gr.Textbox(label="Event Date", value="October 15,
|
| 300 |
venue = gr.Textbox(label="Venue Name", value="Grand Convention Center")
|
| 301 |
notes = gr.Textbox(label="Special Requirements", lines=2)
|
| 302 |
submit = gr.Button("✨ Find Vendors & Generate Documents", elem_classes=["submit-btn"])
|
|
@@ -318,6 +334,7 @@ with gr.Blocks(css=CSS, title="ProSync AI") as demo:
|
|
| 318 |
qs0.click(fn=_qs0, outputs=_form + _out)
|
| 319 |
qs1.click(fn=_qs1, outputs=_form + _out)
|
| 320 |
qs2.click(fn=_qs2, outputs=_form + _out)
|
|
|
|
| 321 |
|
| 322 |
if __name__ == "__main__":
|
| 323 |
demo.launch()
|
|
|
|
| 13 |
import gradio as gr
|
| 14 |
from sentence_transformers import SentenceTransformer, util as st_util
|
| 15 |
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
|
|
|
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
warnings.filterwarnings("ignore")
|
| 18 |
|
| 19 |
os.environ["CUDA_VISIBLE_DEVICES"] = ""
|
|
|
|
| 41 |
CITIES = ["Beer Sheva", "Haifa", "Herzliya", "Jerusalem",
|
| 42 |
"Netanya", "Petah Tikva", "Ramat Gan", "Tel Aviv"]
|
| 43 |
SEASONS = ["Winter", "Spring", "Summer", "Fall"]
|
| 44 |
+
|
| 45 |
+
# Updated to include private events
|
| 46 |
EVENT_TYPES = [
|
| 47 |
+
"Annual Conference", "Award Ceremony", "Bar/Bat Mitzvah", "Brand Activation",
|
| 48 |
+
"Corporate Gala", "Family Reunion", "Investor Day", "Private Birthday",
|
| 49 |
+
"Product Launch", "Team Building", "Tech Summit", "Trade Show", "Wedding", "Workshop Series",
|
| 50 |
]
|
| 51 |
+
|
| 52 |
QUICK_STARTERS = [
|
| 53 |
{
|
| 54 |
"label": "🏙️ Tech Summit · Tel Aviv",
|
|
|
|
| 56 |
"kosher catering for 400 guests, VIP executive security.",
|
| 57 |
"city": "Tel Aviv", "season": "Summer", "budget": 250_000,
|
| 58 |
"type": "Tech Summit", "guests": 400,
|
| 59 |
+
"date": "October 15, 2026", "venue": "The Tel Aviv Convention Center",
|
| 60 |
"notes": "Kosher catering required. VIP lounge for 30 executives.",
|
| 61 |
},
|
| 62 |
{
|
|
|
|
| 65 |
"professional photography and videography for 200 guests.",
|
| 66 |
"city": "Jerusalem", "season": "Winter", "budget": 140_000,
|
| 67 |
"type": "Corporate Gala", "guests": 200,
|
| 68 |
+
"date": "December 5, 2026", "venue": "The King David Hotel Ballroom",
|
| 69 |
"notes": "Black-tie dress code. Award presentation segment.",
|
| 70 |
},
|
| 71 |
{
|
|
|
|
| 74 |
"logistics, casual catering for 150 employees.",
|
| 75 |
"city": "Haifa", "season": "Spring", "budget": 65_000,
|
| 76 |
"type": "Team Building", "guests": 150,
|
| 77 |
+
"date": "April 22, 2026", "venue": "Carmel Forest Resort",
|
| 78 |
"notes": "Outdoor venue preferred. Vegetarian options required.",
|
| 79 |
},
|
| 80 |
+
{
|
| 81 |
+
"label": "💍 Boutique Wedding",
|
| 82 |
+
"brief": "Intimate outdoor wedding — elegant catering, DJ, floral design, "
|
| 83 |
+
"photography, and logistics for 250 guests.",
|
| 84 |
+
"city": "Netanya", "season": "Spring", "budget": 120_000,
|
| 85 |
+
"type": "Wedding", "guests": 250,
|
| 86 |
+
"date": "May 14, 2027", "venue": "Private Estate, Kfar Yona Area",
|
| 87 |
+
"notes": "Chuppah at sunset. Vegan and gluten-free menu options required.",
|
| 88 |
+
}
|
| 89 |
]
|
| 90 |
|
| 91 |
def _to_list(val):
|
|
|
|
| 209 |
return _call_llm(_prompt("You are a senior event production manager. Write a detailed Run of Show using format HH:MM — Task.", f"Event: {ev_type}\nDate: {date}\nVenue: {venue}, {city}\nGuests: {guests:,}\nNotes: {notes or 'None'}\n\nVendors:\n{lines}"))
|
| 210 |
|
| 211 |
def gen_rfp(name, cat, specs, ev_type, date, city, guests, alloc_usd, notes):
|
| 212 |
+
# Prompt updated to be generic enough for private events
|
| 213 |
+
return _call_llm(_prompt("You are a professional event producer writing a formal RFP (Request for Proposal) email to a vendor.", f"Vendor: {name}\nCategory: {cat.replace('_', ' ')}\nEvent: {ev_type}\nDate: {date}\nLocation: {city}\nGuests: {guests:,}\nBudget: ${alloc_usd:,.0f}\nRequirements: {notes or 'Standard service'}"))
|
| 214 |
|
| 215 |
def _stars(r):
|
| 216 |
n = min(5, max(0, int(round(float(r)))))
|
|
|
|
| 275 |
def _qs0(): return _qs(0)
|
| 276 |
def _qs1(): return _qs(1)
|
| 277 |
def _qs2(): return _qs(2)
|
| 278 |
+
def _qs3(): return _qs(3)
|
| 279 |
+
|
| 280 |
+
import spaces
|
| 281 |
+
|
| 282 |
+
@spaces.GPU
|
| 283 |
+
def dummy_gpu_function():
|
| 284 |
+
pass
|
| 285 |
|
| 286 |
CSS = """
|
| 287 |
body, .gradio-container { background-color: #FAF7F2 !important; font-family: 'Inter', sans-serif !important; color: #2C1810 !important; }
|
|
|
|
| 300 |
qs0 = gr.Button(QUICK_STARTERS[0]["label"], elem_classes=["qs-btn"])
|
| 301 |
qs1 = gr.Button(QUICK_STARTERS[1]["label"], elem_classes=["qs-btn"])
|
| 302 |
qs2 = gr.Button(QUICK_STARTERS[2]["label"], elem_classes=["qs-btn"])
|
| 303 |
+
qs3 = gr.Button(QUICK_STARTERS[3]["label"], elem_classes=["qs-btn"])
|
| 304 |
|
| 305 |
brief = gr.Textbox(label="Describe your event", lines=4)
|
| 306 |
with gr.Row():
|
|
|
|
| 312 |
ev_type = gr.Dropdown(label="Event Type", choices=EVENT_TYPES, value="Tech Summit")
|
| 313 |
guests = gr.Number(label="Guest Count", value=300)
|
| 314 |
with gr.Row():
|
| 315 |
+
date = gr.Textbox(label="Event Date", value="October 15, 2026")
|
| 316 |
venue = gr.Textbox(label="Venue Name", value="Grand Convention Center")
|
| 317 |
notes = gr.Textbox(label="Special Requirements", lines=2)
|
| 318 |
submit = gr.Button("✨ Find Vendors & Generate Documents", elem_classes=["submit-btn"])
|
|
|
|
| 334 |
qs0.click(fn=_qs0, outputs=_form + _out)
|
| 335 |
qs1.click(fn=_qs1, outputs=_form + _out)
|
| 336 |
qs2.click(fn=_qs2, outputs=_form + _out)
|
| 337 |
+
qs3.click(fn=_qs3, outputs=_form + _out)
|
| 338 |
|
| 339 |
if __name__ == "__main__":
|
| 340 |
demo.launch()
|