Update app.py
Browse files
app.py
CHANGED
|
@@ -42,18 +42,12 @@ def endpoints(api_key):
|
|
| 42 |
else:
|
| 43 |
model_name = "models/gemini-1.5-pro-latest"
|
| 44 |
return 'GOOGLE'
|
| 45 |
-
return
|
| 46 |
-
|
| 47 |
-
LICENSE = 'MODEL: ' + model_name + ' LOADED'
|
| 48 |
-
endpoints = endpoints(api_key)
|
| 49 |
|
| 50 |
def read(filename):
|
| 51 |
with open(filename) as f:
|
| 52 |
data = f.read()
|
| 53 |
return data
|
| 54 |
|
| 55 |
-
SYS_PROMPT = read('system_prompt.txt')
|
| 56 |
-
|
| 57 |
def process_text(text_input, unit):
|
| 58 |
if text_input and endpoints == 'OPENAI':
|
| 59 |
client = OpenAI(api_key=api_key)
|
|
@@ -110,6 +104,9 @@ def process_image(image_input, unit):
|
|
| 110 |
return response.text
|
| 111 |
|
| 112 |
def main(api_key="", text_input="", image_input=None, unit=""):
|
|
|
|
|
|
|
|
|
|
| 113 |
if text_input and image_input is None:
|
| 114 |
return process_text(text_input,unit)
|
| 115 |
elif image_input is not None:
|
|
|
|
| 42 |
else:
|
| 43 |
model_name = "models/gemini-1.5-pro-latest"
|
| 44 |
return 'GOOGLE'
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
def read(filename):
|
| 47 |
with open(filename) as f:
|
| 48 |
data = f.read()
|
| 49 |
return data
|
| 50 |
|
|
|
|
|
|
|
| 51 |
def process_text(text_input, unit):
|
| 52 |
if text_input and endpoints == 'OPENAI':
|
| 53 |
client = OpenAI(api_key=api_key)
|
|
|
|
| 104 |
return response.text
|
| 105 |
|
| 106 |
def main(api_key="", text_input="", image_input=None, unit=""):
|
| 107 |
+
endpoints = endpoints(api_key)
|
| 108 |
+
SYS_PROMPT = read('system_prompt.txt')
|
| 109 |
+
LICENSE = 'MODEL: ' + model_name + ' LOADED'
|
| 110 |
if text_input and image_input is None:
|
| 111 |
return process_text(text_input,unit)
|
| 112 |
elif image_input is not None:
|