Spaces:
Running
on
Zero
Running
on
Zero
reduce maximum pages
Browse files
app.py
CHANGED
|
@@ -89,7 +89,7 @@ def create_ui():
|
|
| 89 |
|
| 90 |
max_pages_input = gr.Slider(
|
| 91 |
minimum=1,
|
| 92 |
-
maximum=
|
| 93 |
value=20,
|
| 94 |
step=10,
|
| 95 |
label="Max Pages"
|
|
|
|
| 89 |
|
| 90 |
max_pages_input = gr.Slider(
|
| 91 |
minimum=1,
|
| 92 |
+
maximum=50,
|
| 93 |
value=20,
|
| 94 |
step=10,
|
| 95 |
label="Max Pages"
|
rag.py
CHANGED
|
@@ -9,14 +9,17 @@ from PIL import Image
|
|
| 9 |
class Rag:
|
| 10 |
|
| 11 |
def get_answer_from_gemini(self, query, imagePaths):
|
|
|
|
|
|
|
|
|
|
| 12 |
try:
|
| 13 |
genai.configure(api_key=os.environ['GEMINI_API_KEY'])
|
| 14 |
model = genai.GenerativeModel('gemini-1.5-flash')
|
| 15 |
|
| 16 |
images = [Image.open(path) for path in imagePaths]
|
| 17 |
|
| 18 |
-
|
| 19 |
chat = model.start_chat()
|
|
|
|
| 20 |
response = chat.send_message([*images, query])
|
| 21 |
|
| 22 |
answer = response.text
|
|
@@ -31,9 +34,9 @@ class Rag:
|
|
| 31 |
|
| 32 |
|
| 33 |
def get_answer_from_openai(self, query, imagesPaths):
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
payload = self.__get_openai_api_payload(query, imagesPaths)
|
| 38 |
|
| 39 |
headers = {
|
|
|
|
| 9 |
class Rag:
|
| 10 |
|
| 11 |
def get_answer_from_gemini(self, query, imagePaths):
|
| 12 |
+
|
| 13 |
+
print(f"Querying Gemini for query={query}, imagePaths={imagePaths}")
|
| 14 |
+
|
| 15 |
try:
|
| 16 |
genai.configure(api_key=os.environ['GEMINI_API_KEY'])
|
| 17 |
model = genai.GenerativeModel('gemini-1.5-flash')
|
| 18 |
|
| 19 |
images = [Image.open(path) for path in imagePaths]
|
| 20 |
|
|
|
|
| 21 |
chat = model.start_chat()
|
| 22 |
+
|
| 23 |
response = chat.send_message([*images, query])
|
| 24 |
|
| 25 |
answer = response.text
|
|
|
|
| 34 |
|
| 35 |
|
| 36 |
def get_answer_from_openai(self, query, imagesPaths):
|
| 37 |
+
print(f"Querying OpenAI for query={query}, imagesPaths={imagesPaths}")
|
| 38 |
+
|
| 39 |
+
try:
|
| 40 |
payload = self.__get_openai_api_payload(query, imagesPaths)
|
| 41 |
|
| 42 |
headers = {
|