mgokg commited on
Commit
3d552fd
·
verified ·
1 Parent(s): b74e7f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py CHANGED
@@ -6,8 +6,30 @@ from gradio_client import Client
6
  import json
7
  import csv
8
  import pandas
 
 
9
 
 
10
  client = Client("mgokg/PerplexicaApi")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  def parse_links_and_content(ort):
13
  base_url = "https://vereine-in-deutschland.net"
 
6
  import json
7
  import csv
8
  import pandas
9
+ import groq
10
+ import os
11
 
12
+ api_key = os.getenv('groq')
13
  client = Client("mgokg/PerplexicaApi")
14
+ client_groq = groq.Client(api_key=api_key)
15
+
16
+ # Use Llama 3 70B powered by Groq for answering
17
+ def update(message):
18
+ try:
19
+ completion = client_groq.chat.completions.create(
20
+ model="llama3-70b-8192",
21
+ messages=[
22
+ {"role": "system", "content": "You are a helpful assistant."},
23
+ {"role": "user", "content": f"{message}. antworte immer auf deutsch"}
24
+ ],
25
+ )
26
+ return completion.choices[0].message.content
27
+ except Exception as e:
28
+ return f"Error in response generation: {str(e)}"
29
+
30
+
31
+
32
+
33
 
34
  def parse_links_and_content(ort):
35
  base_url = "https://vereine-in-deutschland.net"