Update app104.py
Browse files
app104.py
CHANGED
@@ -17,33 +17,33 @@ warnings.filterwarnings('ignore')
|
|
17 |
os.getenv("OAUTH_CLIENT_ID")
|
18 |
|
19 |
|
20 |
-
#
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
|
27 |
####new
|
28 |
-
from openai import OpenAI
|
29 |
|
30 |
-
client = OpenAI(
|
31 |
-
|
32 |
-
|
33 |
-
)
|
34 |
|
35 |
-
completion = client.chat.completions.create(
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
)
|
45 |
|
46 |
-
print(completion.choices[0].message)
|
47 |
#####
|
48 |
|
49 |
# Create necessary directories
|
|
|
17 |
os.getenv("OAUTH_CLIENT_ID")
|
18 |
|
19 |
|
20 |
+
# Load environment variables and initialize the OpenAI client to use Hugging Face Inference API.
|
21 |
+
load_dotenv()
|
22 |
+
client = OpenAI(
|
23 |
+
base_url="https://api-inference.huggingface.co/v1",
|
24 |
+
api_key=os.environ.get('TOKEN2') # Hugging Face API token
|
25 |
+
)
|
26 |
|
27 |
####new
|
28 |
+
# from openai import OpenAI
|
29 |
|
30 |
+
# client = OpenAI(
|
31 |
+
# base_url="https://router.huggingface.co/together/v1",
|
32 |
+
# api_key=os.environ.get('TOKEN2'),
|
33 |
+
# )
|
34 |
|
35 |
+
# completion = client.chat.completions.create(
|
36 |
+
# model="meta-llama/Meta-Llama-3-8B-Instruct-Turbo",
|
37 |
+
# messages=[
|
38 |
+
# {
|
39 |
+
# "role": "user",
|
40 |
+
# "content": "What is the capital of France?"
|
41 |
+
# }
|
42 |
+
# ],
|
43 |
+
# max_tokens=512,
|
44 |
+
# )
|
45 |
|
46 |
+
# print(completion.choices[0].message)
|
47 |
#####
|
48 |
|
49 |
# Create necessary directories
|