Spaces:
Runtime error
Runtime error
Update app.py
Browse filesadded gemini ai
app.py
CHANGED
@@ -6,6 +6,8 @@ import requests
|
|
6 |
import torch
|
7 |
import torchvision
|
8 |
|
|
|
|
|
9 |
from langchain.prompts import PromptTemplate
|
10 |
from langchain.chains import LLMChain
|
11 |
from langchain.chat_models import ChatOpenAI
|
@@ -17,8 +19,12 @@ from transformers import Pix2StructForConditionalGeneration, Pix2StructProcessor
|
|
17 |
from transformers import BlipProcessor, BlipForConditionalGeneration
|
18 |
import os
|
19 |
|
20 |
-
os.environ["OPENAI_API_KEY"] = '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'
|
21 |
-
|
|
|
|
|
|
|
|
|
22 |
prompt = PromptTemplate(
|
23 |
input_variables=["question", "elements"],
|
24 |
template="""You are a helpful assistant that can answer question related to an image. You have the ability to see the image and answer questions about it.
|
|
|
6 |
import torch
|
7 |
import torchvision
|
8 |
|
9 |
+
from langchain_google_genai import GoogleGenerativeAI
|
10 |
+
|
11 |
from langchain.prompts import PromptTemplate
|
12 |
from langchain.chains import LLMChain
|
13 |
from langchain.chat_models import ChatOpenAI
|
|
|
19 |
from transformers import BlipProcessor, BlipForConditionalGeneration
|
20 |
import os
|
21 |
|
22 |
+
# os.environ["OPENAI_API_KEY"] = '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'
|
23 |
+
os.environ["GOOGLE_API_KEY"] = 'AIzaSyAsZTv6rUZq0TAh6yfmVCDA0tPIcGU3VxA'
|
24 |
+
|
25 |
+
# llm = ChatOpenAI(temperature=0.2, model_name="gpt-3.5-turbo")
|
26 |
+
llm = ChatGoogleGenerativeAI(google_api_key=google_api_key, model="gemini-pro")
|
27 |
+
|
28 |
prompt = PromptTemplate(
|
29 |
input_variables=["question", "elements"],
|
30 |
template="""You are a helpful assistant that can answer question related to an image. You have the ability to see the image and answer questions about it.
|