Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
|
| 2 |
import os
|
| 3 |
import time
|
| 4 |
import re
|
|
@@ -24,7 +24,7 @@ from email.mime.multipart import MIMEMultipart
|
|
| 24 |
from email.mime.text import MIMEText
|
| 25 |
|
| 26 |
# ============================
|
| 27 |
-
# CONFIG
|
| 28 |
# ============================
|
| 29 |
API_KEY = os.environ.get("GOOGLE_API_KEY", "YOUR_GOOGLE_API_KEY")
|
| 30 |
CX = os.environ.get("GOOGLE_CSE_ID", "YOUR_CSE_ID")
|
|
@@ -33,9 +33,9 @@ DEFAULT_COUNTRY = "Ghana"
|
|
| 33 |
RESULTS_PER_QUERY = int(os.environ.get("RESULTS_PER_QUERY", 4))
|
| 34 |
MAX_SCRAPE_WORKERS = int(os.environ.get("MAX_SCRAPE_WORKERS", 6))
|
| 35 |
|
| 36 |
-
ALLY_AI_NAME = os.environ.get("ALLY_AI_NAME", "Ally AI
|
| 37 |
ALLY_AI_LOGO_URL_DEFAULT = os.environ.get("ALLY_AI_LOGO_URL",
|
| 38 |
-
"https://
|
| 39 |
|
| 40 |
COUNTRY_TLD_MAP = {"Ghana":"gh","Nigeria":"ng","Kenya":"ke","South Africa":"za","USA":"us","United Kingdom":"uk"}
|
| 41 |
COUNTRY_REGION_MAP= {"Ghana":"GH","Nigeria":"NG","Kenya":"KE","South Africa":"ZA","USA":"US","United Kingdom":"GB"}
|
|
@@ -571,7 +571,7 @@ def confirm_action(mode, dropdown_value, df_json, subject, message_text,
|
|
| 571 |
|
| 572 |
with gr.Blocks() as demo:
|
| 573 |
gr.Markdown("## Ally AI — GBV Help Finder & Email Assistant\n"
|
| 574 |
-
"This tool searches local professionals/organizations
|
| 575 |
"**Privacy tip:** Prefer anonymized summaries unless you’re comfortable sharing details.")
|
| 576 |
|
| 577 |
with gr.Row():
|
|
@@ -595,11 +595,11 @@ with gr.Blocks() as demo:
|
|
| 595 |
message_in = gr.Textbox(label="Message body", lines=10)
|
| 596 |
|
| 597 |
# Manual override for organization email (new)
|
| 598 |
-
manual_email_in = gr.Textbox(label="Manual org email (optional)
|
| 599 |
|
| 600 |
with gr.Accordion("Sending options (for automatic sending via Ally AI SMTP)", open=False):
|
| 601 |
mode = gr.Radio(choices=["Draft only (mailto + .eml)", "Send via SMTP (Gmail)"], value="Draft only (mailto + .eml)", label="Delivery mode")
|
| 602 |
-
sender_email_in = gr.Textbox(label="Ally AI sender email (
|
| 603 |
sender_pass_in = gr.Textbox(label="Ally AI sender app password", type="password")
|
| 604 |
logo_url_in = gr.Textbox(value=ALLY_AI_LOGO_URL_DEFAULT, label="Ally AI logo URL")
|
| 605 |
|
|
|
|
| 1 |
+
|
| 2 |
import os
|
| 3 |
import time
|
| 4 |
import re
|
|
|
|
| 24 |
from email.mime.text import MIMEText
|
| 25 |
|
| 26 |
# ============================
|
| 27 |
+
# CONFIG
|
| 28 |
# ============================
|
| 29 |
API_KEY = os.environ.get("GOOGLE_API_KEY", "YOUR_GOOGLE_API_KEY")
|
| 30 |
CX = os.environ.get("GOOGLE_CSE_ID", "YOUR_CSE_ID")
|
|
|
|
| 33 |
RESULTS_PER_QUERY = int(os.environ.get("RESULTS_PER_QUERY", 4))
|
| 34 |
MAX_SCRAPE_WORKERS = int(os.environ.get("MAX_SCRAPE_WORKERS", 6))
|
| 35 |
|
| 36 |
+
ALLY_AI_NAME = os.environ.get("ALLY_AI_NAME", "Ally AI")
|
| 37 |
ALLY_AI_LOGO_URL_DEFAULT = os.environ.get("ALLY_AI_LOGO_URL",
|
| 38 |
+
"https://imgur.com/a/lVxnQke")
|
| 39 |
|
| 40 |
COUNTRY_TLD_MAP = {"Ghana":"gh","Nigeria":"ng","Kenya":"ke","South Africa":"za","USA":"us","United Kingdom":"uk"}
|
| 41 |
COUNTRY_REGION_MAP= {"Ghana":"GH","Nigeria":"NG","Kenya":"KE","South Africa":"ZA","USA":"US","United Kingdom":"GB"}
|
|
|
|
| 571 |
|
| 572 |
with gr.Blocks() as demo:
|
| 573 |
gr.Markdown("## Ally AI — GBV Help Finder & Email Assistant\n"
|
| 574 |
+
"This tool searches local professionals/organizations lets you select a contact or enter an email manually, and creates an email draft or sends a branded email via Gmail"
|
| 575 |
"**Privacy tip:** Prefer anonymized summaries unless you’re comfortable sharing details.")
|
| 576 |
|
| 577 |
with gr.Row():
|
|
|
|
| 595 |
message_in = gr.Textbox(label="Message body", lines=10)
|
| 596 |
|
| 597 |
# Manual override for organization email (new)
|
| 598 |
+
manual_email_in = gr.Textbox(label="Manual org email (optional)")
|
| 599 |
|
| 600 |
with gr.Accordion("Sending options (for automatic sending via Ally AI SMTP)", open=False):
|
| 601 |
mode = gr.Radio(choices=["Draft only (mailto + .eml)", "Send via SMTP (Gmail)"], value="Draft only (mailto + .eml)", label="Delivery mode")
|
| 602 |
+
sender_email_in = gr.Textbox(label="Ally AI sender email (Gmail account)")
|
| 603 |
sender_pass_in = gr.Textbox(label="Ally AI sender app password", type="password")
|
| 604 |
logo_url_in = gr.Textbox(value=ALLY_AI_LOGO_URL_DEFAULT, label="Ally AI logo URL")
|
| 605 |
|