Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,7 @@ def process_leads(file):
|
|
9 |
try:
|
10 |
df = pd.read_csv(file.name)
|
11 |
enriched_df = enrich_and_score(df)
|
|
|
12 |
return enriched_df, "β
Leads enriched successfully!"
|
13 |
except Exception as e:
|
14 |
return None, f"β Error processing file: {str(e)}"
|
@@ -25,15 +26,15 @@ def generate_emails(file):
|
|
25 |
return "", f"β Error generating emails: {str(e)}"
|
26 |
|
27 |
with gr.Blocks(css="""
|
28 |
-
body {background-color: #
|
29 |
-
.gradio-container {max-width:
|
30 |
h1 {color: #38bdf8; font-weight: 700; font-size: 2.5em;}
|
31 |
-
p {color: #
|
32 |
-
.tab {background-color: #
|
33 |
.btn-primary {background-color: #2563eb !important; border: none !important; color: white !important;}
|
34 |
.btn-primary:hover {background-color: #1e40af !important;}
|
35 |
-
.gr-dataframe {border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.9); background-color: #
|
36 |
-
.gr-textbox {font-family: monospace; font-size: 14px; background-color: #
|
37 |
.full-width-btn {
|
38 |
width: 100% !important;
|
39 |
padding: 12px 0 !important;
|
@@ -44,7 +45,7 @@ with gr.Blocks(css="""
|
|
44 |
}
|
45 |
.file-info {
|
46 |
font-style: italic;
|
47 |
-
color: #
|
48 |
margin-bottom: 8px;
|
49 |
}
|
50 |
.message-success {
|
@@ -57,6 +58,18 @@ with gr.Blocks(css="""
|
|
57 |
font-weight: 600;
|
58 |
margin-top: 8px;
|
59 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
""") as app:
|
61 |
|
62 |
gr.Markdown("""
|
@@ -71,7 +84,7 @@ with gr.Blocks(css="""
|
|
71 |
lead_file_info = gr.Markdown("", elem_classes="file-info")
|
72 |
lead_output = gr.Dataframe(label="Enriched Leads with Scores", interactive=False)
|
73 |
enrich_btn = gr.Button("β¨ Enrich Leads", variant="primary", elem_classes="full-width-btn")
|
74 |
-
lead_message = gr.Markdown("")
|
75 |
|
76 |
def update_file_info(file):
|
77 |
if file is None:
|
@@ -81,18 +94,31 @@ with gr.Blocks(css="""
|
|
81 |
lead_input.upload(update_file_info, lead_input, lead_file_info)
|
82 |
enrich_btn.click(fn=process_leads, inputs=lead_input, outputs=[lead_output, lead_message], show_progress=True)
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
with gr.TabItem("βοΈ AI Outreach Emails", elem_classes="tab"):
|
85 |
email_input = gr.File(label="Upload the Same CSV", file_types=['.csv'], interactive=True)
|
86 |
email_file_info = gr.Markdown("", elem_classes="file-info")
|
87 |
email_output = gr.Textbox(label="AI-Generated Email Templates", lines=18, interactive=False)
|
88 |
email_btn = gr.Button("π§ Generate Email Templates", variant="primary", elem_classes="full-width-btn")
|
89 |
-
email_message = gr.Markdown("")
|
90 |
|
91 |
email_input.upload(update_file_info, email_input, email_file_info)
|
92 |
email_btn.click(fn=generate_emails, inputs=email_input, outputs=[email_output, email_message], show_progress=True)
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
if __name__ == "__main__":
|
95 |
app.launch()
|
96 |
-
|
97 |
-
|
98 |
-
|
|
|
9 |
try:
|
10 |
df = pd.read_csv(file.name)
|
11 |
enriched_df = enrich_and_score(df)
|
12 |
+
enriched_df = enriched_df.drop_duplicates(subset='Company Name', keep='first')
|
13 |
return enriched_df, "β
Leads enriched successfully!"
|
14 |
except Exception as e:
|
15 |
return None, f"β Error processing file: {str(e)}"
|
|
|
26 |
return "", f"β Error generating emails: {str(e)}"
|
27 |
|
28 |
with gr.Blocks(css="""
|
29 |
+
body {background-color: #0f172a; color: #e2e8f0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;}
|
30 |
+
.gradio-container {max-width: 1000px; margin: auto; padding: 20px;}
|
31 |
h1 {color: #38bdf8; font-weight: 700; font-size: 2.5em;}
|
32 |
+
p {color: #94a3b8;}
|
33 |
+
.tab {background-color: #1e293b; border-radius: 10px; padding: 20px; margin-top: 20px;}
|
34 |
.btn-primary {background-color: #2563eb !important; border: none !important; color: white !important;}
|
35 |
.btn-primary:hover {background-color: #1e40af !important;}
|
36 |
+
.gr-dataframe {border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.9); background-color: #334155;}
|
37 |
+
.gr-textbox {font-family: monospace; font-size: 14px; background-color: #334155; color: #e0e0e0;}
|
38 |
.full-width-btn {
|
39 |
width: 100% !important;
|
40 |
padding: 12px 0 !important;
|
|
|
45 |
}
|
46 |
.file-info {
|
47 |
font-style: italic;
|
48 |
+
color: #94a3b8;
|
49 |
margin-bottom: 8px;
|
50 |
}
|
51 |
.message-success {
|
|
|
58 |
font-weight: 600;
|
59 |
margin-top: 8px;
|
60 |
}
|
61 |
+
.gr-box {
|
62 |
+
background-color: #1e293b;
|
63 |
+
border-radius: 10px;
|
64 |
+
padding: 20px;
|
65 |
+
}
|
66 |
+
.analytics-box {
|
67 |
+
background-color: #0f172a;
|
68 |
+
padding: 10px;
|
69 |
+
margin-top: 10px;
|
70 |
+
border-left: 4px solid #38bdf8;
|
71 |
+
color: #cbd5e1;
|
72 |
+
}
|
73 |
""") as app:
|
74 |
|
75 |
gr.Markdown("""
|
|
|
84 |
lead_file_info = gr.Markdown("", elem_classes="file-info")
|
85 |
lead_output = gr.Dataframe(label="Enriched Leads with Scores", interactive=False)
|
86 |
enrich_btn = gr.Button("β¨ Enrich Leads", variant="primary", elem_classes="full-width-btn")
|
87 |
+
lead_message = gr.Markdown("", elem_classes="message-success")
|
88 |
|
89 |
def update_file_info(file):
|
90 |
if file is None:
|
|
|
94 |
lead_input.upload(update_file_info, lead_input, lead_file_info)
|
95 |
enrich_btn.click(fn=process_leads, inputs=lead_input, outputs=[lead_output, lead_message], show_progress=True)
|
96 |
|
97 |
+
gr.Markdown("""
|
98 |
+
<div class="analytics-box">
|
99 |
+
β
Leads are automatically deduplicated.<br>
|
100 |
+
π Prioritized by relevance & enrichment score.<br>
|
101 |
+
π€ Export enriched data to CSV from top-right corner.
|
102 |
+
</div>
|
103 |
+
""")
|
104 |
+
|
105 |
with gr.TabItem("βοΈ AI Outreach Emails", elem_classes="tab"):
|
106 |
email_input = gr.File(label="Upload the Same CSV", file_types=['.csv'], interactive=True)
|
107 |
email_file_info = gr.Markdown("", elem_classes="file-info")
|
108 |
email_output = gr.Textbox(label="AI-Generated Email Templates", lines=18, interactive=False)
|
109 |
email_btn = gr.Button("π§ Generate Email Templates", variant="primary", elem_classes="full-width-btn")
|
110 |
+
email_message = gr.Markdown("", elem_classes="message-success")
|
111 |
|
112 |
email_input.upload(update_file_info, email_input, email_file_info)
|
113 |
email_btn.click(fn=generate_emails, inputs=email_input, outputs=[email_output, email_message], show_progress=True)
|
114 |
|
115 |
+
gr.Markdown("""
|
116 |
+
<div class="analytics-box">
|
117 |
+
π¬ Emails generated using GPT-based models.<br>
|
118 |
+
π Support for multiple tones, languages, and sender info coming soon.<br>
|
119 |
+
π No emails are stored. 100% safe!
|
120 |
+
</div>
|
121 |
+
""")
|
122 |
+
|
123 |
if __name__ == "__main__":
|
124 |
app.launch()
|
|
|
|
|
|