Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import base64
|
| 3 |
-
from openai import OpenAI
|
|
|
|
|
|
|
| 4 |
|
| 5 |
# Function to encode the image to base64
|
| 6 |
def encode_image(image_file):
|
|
@@ -14,7 +16,9 @@ st.title("MTSS Snapshot: Accessibility Image Textifier: `Alt Text`")
|
|
| 14 |
openai_api_key = st.secrets["openai_api_key"]
|
| 15 |
|
| 16 |
# Initialize the OpenAI client with the API key
|
| 17 |
-
client = OpenAI(api_key=openai_api_key)
|
|
|
|
|
|
|
| 18 |
|
| 19 |
# File uploader allows user to add their own image
|
| 20 |
uploaded_file = st.file_uploader("Upload an image", type=["jpg", "png", "jpeg"])
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import base64
|
| 3 |
+
# from openai import OpenAI
|
| 4 |
+
import openai
|
| 5 |
+
|
| 6 |
|
| 7 |
# Function to encode the image to base64
|
| 8 |
def encode_image(image_file):
|
|
|
|
| 16 |
openai_api_key = st.secrets["openai_api_key"]
|
| 17 |
|
| 18 |
# Initialize the OpenAI client with the API key
|
| 19 |
+
# client = OpenAI(api_key=openai_api_key)
|
| 20 |
+
client = openai.api_key(api_key=openai_api_key)
|
| 21 |
+
# openai.api_key = openai_api_key
|
| 22 |
|
| 23 |
# File uploader allows user to add their own image
|
| 24 |
uploaded_file = st.file_uploader("Upload an image", type=["jpg", "png", "jpeg"])
|