Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ import google.generativeai as genai
|
|
| 6 |
API_KEY = os.environ.get("GOOGLE_API_KEY")
|
| 7 |
|
| 8 |
if not API_KEY:
|
| 9 |
-
raise ValueError("GOOGLE_API_KEY environment variable not set. Please add it to your Hugging
|
| 10 |
|
| 11 |
# Configure the Gemini API with the key
|
| 12 |
genai.configure(api_key=API_KEY)
|
|
@@ -34,7 +34,7 @@ def analyze_trend(industry: str) -> str:
|
|
| 34 |
# Use the GenerativeModel to generate content, passing the tool directly to the method
|
| 35 |
response = model.generate_content(
|
| 36 |
prompt,
|
| 37 |
-
tools=[
|
| 38 |
# Stream the response for a better user experience
|
| 39 |
stream=True
|
| 40 |
)
|
|
|
|
| 6 |
API_KEY = os.environ.get("GOOGLE_API_KEY")
|
| 7 |
|
| 8 |
if not API_KEY:
|
| 9 |
+
raise ValueError("GOOGLE_API_KEY environment variable not set. Please add it to your Hugging Space Secrets.")
|
| 10 |
|
| 11 |
# Configure the Gemini API with the key
|
| 12 |
genai.configure(api_key=API_KEY)
|
|
|
|
| 34 |
# Use the GenerativeModel to generate content, passing the tool directly to the method
|
| 35 |
response = model.generate_content(
|
| 36 |
prompt,
|
| 37 |
+
tools=[genai.Tool.from_google_search()],
|
| 38 |
# Stream the response for a better user experience
|
| 39 |
stream=True
|
| 40 |
)
|