Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
-
|
|
|
3 |
import os
|
4 |
import logging
|
5 |
import whisper
|
@@ -8,9 +9,32 @@ import tempfile
|
|
8 |
from pydub import AudioSegment
|
9 |
from groq import Groq, GroqError
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
# Configure API keys securely
|
12 |
-
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
13 |
-
genai.configure(api_key=GOOGLE_API_KEY)
|
14 |
|
15 |
groq_api_key = os.getenv('GROQ_API_KEY')
|
16 |
if not groq_api_key:
|
|
|
1 |
import streamlit as st
|
2 |
+
from google.cloud import aiplatform
|
3 |
+
#import google.generativeai as genai
|
4 |
import os
|
5 |
import logging
|
6 |
import whisper
|
|
|
9 |
from pydub import AudioSegment
|
10 |
from groq import Groq, GroqError
|
11 |
|
12 |
+
|
13 |
+
from google.cloud import aiplatform
|
14 |
+
|
15 |
+
# Initialize the client
|
16 |
+
def init_palm(api_key):
|
17 |
+
aiplatform.init(api_key=api_key)
|
18 |
+
|
19 |
+
# Function to generate responses
|
20 |
+
def generate_palm_response(prompt):
|
21 |
+
response = aiplatform.Model.predict(
|
22 |
+
model_name="gemini-1.5-flash",
|
23 |
+
instances=[{"prompt": prompt}]
|
24 |
+
)
|
25 |
+
return response.predictions[0]['content']
|
26 |
+
|
27 |
+
# Call the model
|
28 |
+
api_key = "your-google-api-key"
|
29 |
+
init_palm(api_key)
|
30 |
+
response = generate_palm_response("Heart health query...")
|
31 |
+
print(response)
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
# Configure API keys securely
|
36 |
+
#GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
37 |
+
#genai.configure(api_key=GOOGLE_API_KEY)
|
38 |
|
39 |
groq_api_key = os.getenv('GROQ_API_KEY')
|
40 |
if not groq_api_key:
|