ibrahim313 commited on
Commit
e682c91
·
verified ·
1 Parent(s): f13d91a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -2,7 +2,7 @@ import io
2
  import base64
3
  import streamlit as st
4
  import os
5
- from together import Together
6
  from PIL import Image
7
  import requests
8
  from io import BytesIO
@@ -114,16 +114,16 @@ st.markdown("""
114
  </style>
115
  """, unsafe_allow_html=True)
116
 
117
- # Initialize the Together client with error handling
118
  @st.cache_resource
119
- def get_together_client():
120
  try:
121
- return Together(api_key=st.secrets["api_key"])
122
  except Exception as e:
123
  st.error(f"Error initializing API client: {str(e)}")
124
  return None
125
 
126
- client = get_together_client()
127
 
128
  # Load animations
129
  lottie_telecom = load_lottie("https://assets4.lottiefiles.com/packages/lf20_qz3tpn4w.json")
 
2
  import base64
3
  import streamlit as st
4
  import os
5
+ from openai import OpenAI
6
  from PIL import Image
7
  import requests
8
  from io import BytesIO
 
114
  </style>
115
  """, unsafe_allow_html=True)
116
 
117
+ # Initialize the OpenAI client with error handling
118
  @st.cache_resource
119
+ def get_openai_client():
120
  try:
121
+ return OpenAI(api_key=st.secrets["api_key"], base_url="https://api.together.xyz")
122
  except Exception as e:
123
  st.error(f"Error initializing API client: {str(e)}")
124
  return None
125
 
126
+ client = get_openai_client()
127
 
128
  # Load animations
129
  lottie_telecom = load_lottie("https://assets4.lottiefiles.com/packages/lf20_qz3tpn4w.json")