Update app.py
Browse files
app.py
CHANGED
@@ -19,8 +19,8 @@ config = {
|
|
19 |
}
|
20 |
|
21 |
RAG_OFF = "Off"
|
22 |
-
|
23 |
-
|
24 |
|
25 |
def invoke(openai_api_key, prompt, rag_option):
|
26 |
if (openai_api_key == ""):
|
@@ -75,14 +75,14 @@ gr.close_all()
|
|
75 |
demo = gr.Interface(fn = invoke,
|
76 |
inputs = [gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1, value = "sk-"),
|
77 |
gr.Textbox(label = "Prompt", value = "What are GPT-4's media capabilities in 5 emojis and 1 sentence?", lines = 1),
|
78 |
-
gr.Radio([RAG_OFF,
|
79 |
outputs = [gr.Textbox(label = "Completion", lines = 1)],
|
80 |
title = "Context-Aware Multimodal Reasoning Application",
|
81 |
description = os.environ["DESCRIPTION"],
|
82 |
examples = [["sk-", "What are GPT-4's media capabilities in 5 emojis and 1 sentence?", RAG_MONGODB],
|
83 |
-
["sk-", "List GPT-4's exam scores and benchmark results.",
|
84 |
["sk-", "Compare GPT-4 to GPT-3.5 in markdown table format.", RAG_MONGODB],
|
85 |
-
["sk-", "Write a Python program that calls the GPT-4 API.",
|
86 |
["sk-", "What is the GPT-4 API's cost and rate limit? Answer in English, Arabic, Chinese, Hindi, and Russian in JSON format.", RAG_MONGODB],],
|
87 |
cache_examples = False)
|
88 |
|
|
|
19 |
}
|
20 |
|
21 |
RAG_OFF = "Off"
|
22 |
+
RAG_MONGODB = "MongoDB" # serverless
|
23 |
+
RAG_CHROMA = "Chroma" # requires persistent storage (small is $0.01/hour)
|
24 |
|
25 |
def invoke(openai_api_key, prompt, rag_option):
|
26 |
if (openai_api_key == ""):
|
|
|
75 |
demo = gr.Interface(fn = invoke,
|
76 |
inputs = [gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1, value = "sk-"),
|
77 |
gr.Textbox(label = "Prompt", value = "What are GPT-4's media capabilities in 5 emojis and 1 sentence?", lines = 1),
|
78 |
+
gr.Radio([RAG_OFF, RAG_MONGODB], label = "Retrieval-Augmented Generation", value = RAG_OFF),],
|
79 |
outputs = [gr.Textbox(label = "Completion", lines = 1)],
|
80 |
title = "Context-Aware Multimodal Reasoning Application",
|
81 |
description = os.environ["DESCRIPTION"],
|
82 |
examples = [["sk-", "What are GPT-4's media capabilities in 5 emojis and 1 sentence?", RAG_MONGODB],
|
83 |
+
["sk-", "List GPT-4's exam scores and benchmark results.", RAG_MONGODB],
|
84 |
["sk-", "Compare GPT-4 to GPT-3.5 in markdown table format.", RAG_MONGODB],
|
85 |
+
["sk-", "Write a Python program that calls the GPT-4 API.", RAG_MONGODB],
|
86 |
["sk-", "What is the GPT-4 API's cost and rate limit? Answer in English, Arabic, Chinese, Hindi, and Russian in JSON format.", RAG_MONGODB],],
|
87 |
cache_examples = False)
|
88 |
|