Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,17 +3,17 @@ import gradio as gr
|
|
3 |
import datetime as dt
|
4 |
import pytz
|
5 |
|
6 |
-
from openai import OpenAI
|
7 |
from dotenv import load_dotenv
|
8 |
load_dotenv()
|
|
|
9 |
|
10 |
-
# Get the
|
11 |
-
|
12 |
-
if not
|
13 |
-
raise ValueError("
|
14 |
|
15 |
-
#
|
16 |
-
client =
|
17 |
|
18 |
System_msg = "act as an experienced blockchain developer,you have been working in this field from the past 15 years.help me understand some concepts, assume i am a complete begineer"
|
19 |
|
@@ -41,7 +41,7 @@ def predict(message,history):
|
|
41 |
history_list.append({"role": "user", "content": message})
|
42 |
|
43 |
response = client.chat.completions.create(
|
44 |
-
model = "
|
45 |
messages = history_list,
|
46 |
temperature = 1.0,
|
47 |
max_tokens=4000,
|
|
|
3 |
import datetime as dt
|
4 |
import pytz
|
5 |
|
|
|
6 |
from dotenv import load_dotenv
|
7 |
load_dotenv()
|
8 |
+
from groq import Groq
|
9 |
|
10 |
+
# Get the API key from an environment variable
|
11 |
+
groq_api_key = os.getenv("GROQ_API_KEY")
|
12 |
+
if not groq_api_key:
|
13 |
+
raise ValueError("GROQ_API_KEY environment variable is not set")
|
14 |
|
15 |
+
# Initialize Groq client
|
16 |
+
client = Groq(api_key=groq_api_key)
|
17 |
|
18 |
System_msg = "act as an experienced blockchain developer,you have been working in this field from the past 15 years.help me understand some concepts, assume i am a complete begineer"
|
19 |
|
|
|
41 |
history_list.append({"role": "user", "content": message})
|
42 |
|
43 |
response = client.chat.completions.create(
|
44 |
+
model = "llama-3.1-8b-instant",
|
45 |
messages = history_list,
|
46 |
temperature = 1.0,
|
47 |
max_tokens=4000,
|