Spaces:
Runtime error
Runtime error
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -19,8 +19,15 @@ from google.adk.agents import Agent, SequentialAgent, ParallelAgent
|
|
| 19 |
from google.adk.runners import InMemoryRunner
|
| 20 |
from google.adk.tools import AgentTool, google_search
|
| 21 |
|
| 22 |
-
# Get API key from environment (for Hugging Face Spaces)
|
| 23 |
-
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
# Set up environment
|
| 26 |
os.environ["GOOGLE_API_KEY"] = GOOGLE_API_KEY
|
|
@@ -579,16 +586,24 @@ with gr.Blocks(
|
|
| 579 |
1. **Tech, Health, Finance Researchers** work in parallel
|
| 580 |
2. Each searches for trends in their domain (simultaneously!)
|
| 581 |
3. **Aggregator Agent** combines findings into executive summary
|
|
|
|
|
|
|
| 582 |
""")
|
| 583 |
|
| 584 |
-
briefing_type = gr.
|
| 585 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 586 |
"Technology, Health, and Finance",
|
| 587 |
"AI, Sustainability, and Education",
|
| 588 |
"Cybersecurity, Cloud Computing, and DevOps",
|
| 589 |
],
|
| 590 |
-
|
| 591 |
-
label="
|
| 592 |
)
|
| 593 |
|
| 594 |
parallel_btn = gr.Button("📈 Generate Executive Briefing", variant="primary")
|
|
@@ -606,7 +621,7 @@ with gr.Blocks(
|
|
| 606 |
|
| 607 |
def parallel_with_status(topics):
|
| 608 |
if not topics or not topics.strip():
|
| 609 |
-
return "Please
|
| 610 |
return parallel_chat(topics), "✅ Executive briefing complete!"
|
| 611 |
|
| 612 |
parallel_btn.click(
|
|
|
|
| 19 |
from google.adk.runners import InMemoryRunner
|
| 20 |
from google.adk.tools import AgentTool, google_search
|
| 21 |
|
| 22 |
+
# Get API key from environment (required for Hugging Face Spaces)
|
| 23 |
+
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
| 24 |
+
|
| 25 |
+
if not GOOGLE_API_KEY:
|
| 26 |
+
raise ValueError(
|
| 27 |
+
"GOOGLE_API_KEY environment variable is required.\n"
|
| 28 |
+
"For Hugging Face Spaces: Add it as a secret in Space settings.\n"
|
| 29 |
+
"For local development: Set it with 'export GOOGLE_API_KEY=your-key'"
|
| 30 |
+
)
|
| 31 |
|
| 32 |
# Set up environment
|
| 33 |
os.environ["GOOGLE_API_KEY"] = GOOGLE_API_KEY
|
|
|
|
| 586 |
1. **Tech, Health, Finance Researchers** work in parallel
|
| 587 |
2. Each searches for trends in their domain (simultaneously!)
|
| 588 |
3. **Aggregator Agent** combines findings into executive summary
|
| 589 |
+
|
| 590 |
+
**Enter exactly three comma-separated topics** to build a custom briefing.
|
| 591 |
""")
|
| 592 |
|
| 593 |
+
briefing_type = gr.Textbox(
|
| 594 |
+
label="Briefing Topics (3 comma-separated domains)",
|
| 595 |
+
value="Technology, Health, and Finance",
|
| 596 |
+
placeholder="e.g., AI Safety, Robotics, Supply Chain Automation",
|
| 597 |
+
)
|
| 598 |
+
|
| 599 |
+
gr.Examples(
|
| 600 |
+
examples=[
|
| 601 |
"Technology, Health, and Finance",
|
| 602 |
"AI, Sustainability, and Education",
|
| 603 |
"Cybersecurity, Cloud Computing, and DevOps",
|
| 604 |
],
|
| 605 |
+
inputs=briefing_type,
|
| 606 |
+
label="Suggested combinations",
|
| 607 |
)
|
| 608 |
|
| 609 |
parallel_btn = gr.Button("📈 Generate Executive Briefing", variant="primary")
|
|
|
|
| 621 |
|
| 622 |
def parallel_with_status(topics):
|
| 623 |
if not topics or not topics.strip():
|
| 624 |
+
return "Please enter briefing topics.", "❌ No topics provided"
|
| 625 |
return parallel_chat(topics), "✅ Executive briefing complete!"
|
| 626 |
|
| 627 |
parallel_btn.click(
|