Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,11 @@ import gradio as gr
|
|
2 |
import base64
|
3 |
from groq import Groq
|
4 |
from io import BytesIO
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
# Function to encode the image to base64
|
7 |
def encode_image(image):
|
@@ -13,7 +18,7 @@ def encode_image(image):
|
|
13 |
return base64.b64encode(buffered.getvalue()).decode("utf-8")
|
14 |
|
15 |
# Initialize the GROQ client
|
16 |
-
client = Groq(api_key=
|
17 |
|
18 |
def vqa_function(image, question):
|
19 |
"""
|
|
|
2 |
import base64
|
3 |
from groq import Groq
|
4 |
from io import BytesIO
|
5 |
+
from dotenv import load_dotenv
|
6 |
+
|
7 |
+
load_dotenv()
|
8 |
+
|
9 |
+
api_key = os.getenv("API_KEY")
|
10 |
|
11 |
# Function to encode the image to base64
|
12 |
def encode_image(image):
|
|
|
18 |
return base64.b64encode(buffered.getvalue()).decode("utf-8")
|
19 |
|
20 |
# Initialize the GROQ client
|
21 |
+
client = Groq(api_key=api_key)
|
22 |
|
23 |
def vqa_function(image, question):
|
24 |
"""
|