Atreyu4EVR commited on
Commit
47f1a97
·
verified ·
1 Parent(s): c79c071

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -12
app.py CHANGED
@@ -13,16 +13,12 @@ load_dotenv()
13
  MAX_TOKENS = 4000
14
  DEFAULT_TEMPERATURE = 0.5
15
 
16
- # Initialize the client
17
- def initialize_client():
18
- api_key = os.environ.get('HUGGINGFACEHUB_API_TOKEN')
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
- )
26
 
27
  # Create supported models
28
  model_links = {
@@ -49,8 +45,6 @@ st.sidebar.button('Reset Chat', on_click=reset_conversation) #Reset button
49
  def main():
50
  st.header('Multi-Models')
51
 
52
- # Initialize client
53
- client = initialize_client()
54
 
55
  # Sidebar for model selection and temperature
56
  selected_model = st.sidebar.selectbox("Select Model", list(model_links.keys()))
 
13
  MAX_TOKENS = 4000
14
  DEFAULT_TEMPERATURE = 0.5
15
 
16
+ # initialize the client
17
+ client = OpenAI(
18
+ base_url="https://api-inference.huggingface.co/v1",
19
+ api_key=os.environ.get('API_KEY') # Replace with your token
20
+ )
21
+
 
 
 
 
22
 
23
  # Create supported models
24
  model_links = {
 
45
  def main():
46
  st.header('Multi-Models')
47
 
 
 
48
 
49
  # Sidebar for model selection and temperature
50
  selected_model = st.sidebar.selectbox("Select Model", list(model_links.keys()))