Darshan03 commited on
Commit
6053330
·
verified ·
1 Parent(s): fdc1c33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py CHANGED
@@ -44,6 +44,7 @@ def scrape_website(url):
44
  return f"Failed to retrieve page. Status code: {response.status_code}"
45
 
46
 
 
47
  # Load environment variables from .env
48
  load_dotenv()
49
 
@@ -79,7 +80,24 @@ if uploaded_file is not None:
79
  "Real Estate",
80
  "Utilities"
81
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
 
83
  # Fetch stock data
84
  st.write("Fetching stock data...")
85
  stock_symbols = [value["symbol"] for value in stock_data.values()]
 
44
  return f"Failed to retrieve page. Status code: {response.status_code}"
45
 
46
 
47
+
48
  # Load environment variables from .env
49
  load_dotenv()
50
 
 
80
  "Real Estate",
81
  "Utilities"
82
  ]
83
+ def configure_generative_ai():
84
+ """Configures the generative AI model and starts a chat session."""
85
+ genai.configure(api_key=Config.GOOGLE_API_KEY)
86
+
87
+ generation_config = {
88
+ "temperature": 1,
89
+ "top_p": 0.95,
90
+ "top_k": 40,
91
+ "max_output_tokens": 8192,
92
+ "response_mime_type": "text/plain",
93
+ }
94
+
95
+ model = genai.GenerativeModel(
96
+ model_name="gemini-2.0-flash-exp",
97
+ generation_config=generation_config,
98
+ )
99
 
100
+ return model.start_chat()
101
  # Fetch stock data
102
  st.write("Fetching stock data...")
103
  stock_symbols = [value["symbol"] for value in stock_data.values()]