mgokg commited on
Commit
1605c68
·
verified ·
1 Parent(s): e6e717a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -8
app.py CHANGED
@@ -6,8 +6,10 @@ import os
6
  import json
7
  import pandas as pd
8
  from io import StringIO
 
9
 
10
  # Load environment variables
 
11
  api_key = os.environ.get('GROQ_API_KEY')
12
  read_key = os.environ.get('HF_TOKEN', None)
13
 
@@ -143,15 +145,31 @@ with gr.Blocks() as demo:
143
  links_text, links = parse_links_and_content(ort)
144
  #return links_text
145
  kontakt = []
146
- url = "https://www.google.com/search?q=impressum+sv+garitz"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  for verein in links_text:
148
- #url = f"https://www.google.com/search?q=impressum+{verein}"
149
- response = requests.get(url)
150
- response.raise_for_status()
151
- soup = BeautifulSoup(response.content, 'html.parser')
152
- detail = soup.find("div", class_= "A6K0A")
153
- #detail = soup.select_one('#rso > div:nth-child(1)')
154
- kontakt.append(detail)
155
 
156
 
157
  return kontakt
 
6
  import json
7
  import pandas as pd
8
  from io import StringIO
9
+ import google.generativeai as genai
10
 
11
  # Load environment variables
12
+ genai.configure(api_key=os.environ["geminiapikey"])
13
  api_key = os.environ.get('GROQ_API_KEY')
14
  read_key = os.environ.get('HF_TOKEN', None)
15
 
 
145
  links_text, links = parse_links_and_content(ort)
146
  #return links_text
147
  kontakt = []
148
+
149
+ # Create the model
150
+ generation_config = {
151
+ "temperature": 1,
152
+ "top_p": 0.95,
153
+ "top_k": 40,
154
+ "max_output_tokens": 8192,
155
+ "response_mime_type": "text/plain",
156
+ }
157
+
158
+ model = genai.GenerativeModel(
159
+ model_name="gemini-2.0-flash-exp",
160
+ generation_config=generation_config,
161
+ )
162
+
163
+ chat_session = model.start_chat(
164
+ history=[
165
+ ]
166
+ )
167
+
168
+
169
  for verein in links_text:
170
+ response = chat_session.send_message(f"kontakdaten für {verein}")
171
+
172
+ kontakt.append(response.text)
 
 
 
 
173
 
174
 
175
  return kontakt