Spaces:
Running
Running
Commit
·
82babfb
1
Parent(s):
9f288f7
file upload gallery
Browse files
app.py
CHANGED
|
@@ -608,6 +608,24 @@ def image_to_base64(img):
|
|
| 608 |
# # Apply the CSS
|
| 609 |
# st.markdown(css, unsafe_allow_html=True)
|
| 610 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 611 |
def display_image_gallery():
|
| 612 |
# Initialize the container
|
| 613 |
con_image = st.empty()
|
|
@@ -1270,14 +1288,14 @@ def content_header():
|
|
| 1270 |
with col_run_2:
|
| 1271 |
st.subheader('Run Tests', help="")
|
| 1272 |
st.write('We include a single image for testing. If you want to test all of the available prompts and LLMs on a different set of images, copy your images into `../VoucherVision/demo/demo_images`.')
|
| 1273 |
-
if st.button("Test GPT"):
|
| 1274 |
progress_report.set_n_overall(TestOptionsGPT.get_length())
|
| 1275 |
test_results, JSON_results = run_demo_tests_GPT(progress_report)
|
| 1276 |
with col_test:
|
| 1277 |
display_test_results(test_results, JSON_results, 'gpt')
|
| 1278 |
st.balloons()
|
| 1279 |
|
| 1280 |
-
if st.button("Test PaLM2"):
|
| 1281 |
progress_report.set_n_overall(TestOptionsPalm.get_length())
|
| 1282 |
test_results, JSON_results = run_demo_tests_Palm(progress_report)
|
| 1283 |
with col_test:
|
|
@@ -1285,17 +1303,20 @@ def content_header():
|
|
| 1285 |
st.balloons()
|
| 1286 |
|
| 1287 |
with col_run_3:
|
| 1288 |
-
st.subheader('
|
| 1289 |
-
|
| 1290 |
-
|
| 1291 |
-
|
| 1292 |
-
|
| 1293 |
-
|
| 1294 |
-
|
| 1295 |
-
|
| 1296 |
-
|
| 1297 |
-
|
| 1298 |
-
|
|
|
|
|
|
|
|
|
|
| 1299 |
|
| 1300 |
def content_tab_settings():
|
| 1301 |
col_project_1, col_project_2, col_project_3 = st.columns([2,2,2])
|
|
|
|
| 608 |
# # Apply the CSS
|
| 609 |
# st.markdown(css, unsafe_allow_html=True)
|
| 610 |
|
| 611 |
+
def show_available_APIs():
|
| 612 |
+
has_key_openai = bool(os.getenv('OPENAI_API_KEY')) is not None
|
| 613 |
+
has_key_google_OCR = bool(os.getenv('GOOGLE_APPLICATION_CREDENTIALS')) is not None
|
| 614 |
+
has_key_palm2 = bool(os.getenv('PALM_API_KEY')) is not None
|
| 615 |
+
has_key_azure = bool(os.getenv('AZURE_API_KEY')) is not None
|
| 616 |
+
|
| 617 |
+
emoji_good = ":heavy_check_mark:"
|
| 618 |
+
emoji_bad = ":x:"
|
| 619 |
+
|
| 620 |
+
table = {
|
| 621 |
+
'OpenAI API': emoji_good if has_key_openai else emoji_bad,
|
| 622 |
+
'Google OCR API': emoji_good if has_key_google_OCR else emoji_bad,
|
| 623 |
+
'Palm API': emoji_good if has_key_palm2 else emoji_bad,
|
| 624 |
+
'Azure API': emoji_good if has_key_azure else emoji_bad,
|
| 625 |
+
}
|
| 626 |
+
for api_name, status in table.items():
|
| 627 |
+
st.markdown(f"* {status} {api_name}")
|
| 628 |
+
|
| 629 |
def display_image_gallery():
|
| 630 |
# Initialize the container
|
| 631 |
con_image = st.empty()
|
|
|
|
| 1288 |
with col_run_2:
|
| 1289 |
st.subheader('Run Tests', help="")
|
| 1290 |
st.write('We include a single image for testing. If you want to test all of the available prompts and LLMs on a different set of images, copy your images into `../VoucherVision/demo/demo_images`.')
|
| 1291 |
+
if st.button("Test GPT",disabled=True):
|
| 1292 |
progress_report.set_n_overall(TestOptionsGPT.get_length())
|
| 1293 |
test_results, JSON_results = run_demo_tests_GPT(progress_report)
|
| 1294 |
with col_test:
|
| 1295 |
display_test_results(test_results, JSON_results, 'gpt')
|
| 1296 |
st.balloons()
|
| 1297 |
|
| 1298 |
+
if st.button("Test PaLM2",disabled=True):
|
| 1299 |
progress_report.set_n_overall(TestOptionsPalm.get_length())
|
| 1300 |
test_results, JSON_results = run_demo_tests_Palm(progress_report)
|
| 1301 |
with col_test:
|
|
|
|
| 1303 |
st.balloons()
|
| 1304 |
|
| 1305 |
with col_run_3:
|
| 1306 |
+
st.subheader('Available LLMs and APIs')
|
| 1307 |
+
show_available_APIs()
|
| 1308 |
+
st.info('Until the end of 2023, Azure OpenAI models will be available for anyone to use here. Then only PaLM 2 will be available. To use all services, duplicate this Space and provide your own API keys.')
|
| 1309 |
+
# st.subheader('Check GPU')
|
| 1310 |
+
# if st.button("GPU"):
|
| 1311 |
+
# success, info = test_GPU()
|
| 1312 |
+
|
| 1313 |
+
# if success:
|
| 1314 |
+
# st.balloons()
|
| 1315 |
+
# for message in info:
|
| 1316 |
+
# st.success(message)
|
| 1317 |
+
# else:
|
| 1318 |
+
# for message in info:
|
| 1319 |
+
# st.error(message)
|
| 1320 |
|
| 1321 |
def content_tab_settings():
|
| 1322 |
col_project_1, col_project_2, col_project_3 = st.columns([2,2,2])
|