Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -24,26 +24,25 @@ custom_css = """
|
|
24 |
|
25 |
# Verwende die integrierten Embeddings von ChromaDB
|
26 |
embedding_function = embedding_functions.DefaultEmbeddingFunction()
|
|
|
27 |
|
28 |
def update(json):
|
29 |
-
|
30 |
-
|
31 |
-
'method': 'POST',
|
32 |
-
'headers': {
|
33 |
-
'Authorization': f"{groq}",
|
34 |
-
'Content-Type': 'application/json'
|
35 |
-
},
|
36 |
-
'body': json.dumps({
|
37 |
-
'messages': [{'role': 'user', 'content': json}],
|
38 |
-
'model': 'mixtral-8x7b-32768'
|
39 |
-
})
|
40 |
-
}
|
41 |
-
|
42 |
-
response = requests.post(url, headers=options['headers'], json=options['body'])
|
43 |
-
data = response.json()
|
44 |
-
response_content = data['choices'][0]['message']['content']
|
45 |
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
#def text_to_speech(text):
|
49 |
#engine = pyttsx3.init()
|
@@ -59,7 +58,7 @@ def transcribe_audio(audio):
|
|
59 |
audio_data = recognizer.record(source)
|
60 |
try:
|
61 |
text = recognizer.recognize_google(audio_data, language="de-DE")
|
62 |
-
|
63 |
#return result
|
64 |
result = client.predict(
|
65 |
query=text,
|
|
|
24 |
|
25 |
# Verwende die integrierten Embeddings von ChromaDB
|
26 |
embedding_function = embedding_functions.DefaultEmbeddingFunction()
|
27 |
+
client = Client("Qwen/Qwen2.5-72B-Instruct")
|
28 |
|
29 |
def update(json):
|
30 |
+
|
31 |
+
client = groq.Client(api_key=f"{groq}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
+
try:
|
34 |
+
# Use Llama 3 70B powered by Groq for text generation
|
35 |
+
completion = client.chat.completions.create(
|
36 |
+
model="llama3-70b-8192",
|
37 |
+
messages=[
|
38 |
+
{"role": "system", "content": "You are a helpful assistant."},
|
39 |
+
{"role": "user", "content": f"{json}"}
|
40 |
+
],
|
41 |
+
)
|
42 |
+
return completion.choices[0].message.content
|
43 |
+
except Exception as e:
|
44 |
+
return f"Error in response generation: {str(e)}"
|
45 |
+
|
46 |
|
47 |
#def text_to_speech(text):
|
48 |
#engine = pyttsx3.init()
|
|
|
58 |
audio_data = recognizer.record(source)
|
59 |
try:
|
60 |
text = recognizer.recognize_google(audio_data, language="de-DE")
|
61 |
+
result = update(text)
|
62 |
#return result
|
63 |
result = client.predict(
|
64 |
query=text,
|