Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
from openai import OpenAI
|
| 3 |
import os
|
| 4 |
import numpy as np
|
| 5 |
import sys
|
| 6 |
from dotenv import load_dotenv
|
| 7 |
import random
|
|
|
|
| 8 |
|
| 9 |
# Load environment variables
|
| 10 |
load_dotenv()
|
|
@@ -19,7 +19,7 @@ def initialize_client():
|
|
| 19 |
if not api_key:
|
| 20 |
st.error("HUGGINGFACEHUB_API_TOKEN not found in environment variables.")
|
| 21 |
st.stop()
|
| 22 |
-
return
|
| 23 |
base_url="https://api-inference.huggingface.co/v1",
|
| 24 |
api_key=api_key
|
| 25 |
)
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
import os
|
| 3 |
import numpy as np
|
| 4 |
import sys
|
| 5 |
from dotenv import load_dotenv
|
| 6 |
import random
|
| 7 |
+
from huggingface_hub import InferenceClient
|
| 8 |
|
| 9 |
# Load environment variables
|
| 10 |
load_dotenv()
|
|
|
|
| 19 |
if not api_key:
|
| 20 |
st.error("HUGGINGFACEHUB_API_TOKEN not found in environment variables.")
|
| 21 |
st.stop()
|
| 22 |
+
return InferenceClient(
|
| 23 |
base_url="https://api-inference.huggingface.co/v1",
|
| 24 |
api_key=api_key
|
| 25 |
)
|