Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -36,13 +36,11 @@ from transformers import GPT2TokenizerFast
|
|
| 36 |
USE_INTERFACE = True # Change to False if you want to run the code without the Gradio interface, and instead see a single pre-supplied question
|
| 37 |
filepath = '2023_investment_outlook.docx'
|
| 38 |
# Path to document containing domain content. Initial cleaning of domain content
|
| 39 |
-
# can be done inside (eg, using Python) or outside (eg, using Word),
|
| 40 |
# depending on needs and circumstances.
|
| 41 |
# emb_filepath = 'PATH HERE' # Path to document containing saved content embeddings, if applicable
|
| 42 |
COMPLETIONS_MODEL = "text-davinci-003"
|
| 43 |
-
# Get the value of
|
| 44 |
-
# secrets = openai_secret_manager.get_secrets("API-KEY")
|
| 45 |
-
# openai.api_key = secrets["api_key"]
|
| 46 |
openai.api_key = os.environ["API-KEY"]
|
| 47 |
MODEL_NAME = "curie"
|
| 48 |
DOC_EMBEDDINGS_MODEL = f"text-search-{MODEL_NAME}-doc-001"
|
|
@@ -334,9 +332,9 @@ if USE_INTERFACE:
|
|
| 334 |
outputs=gr.Textbox(lines=2, label="Answer"),
|
| 335 |
description="Example of a domain-specific chatbot, using ChatGPT with supplemental content added.<br>\
|
| 336 |
Here, the content relates to the investment outlook for 2023, according to Morgan Stanley, JPMorgan and Goldman Sachs.<br>\
|
| 337 |
-
Sample queries:
|
| 338 |
-
NOTE: High-level demo only. Supplemental content
|
| 339 |
-
|
| 340 |
title="Domain-Specific Chatbot",)
|
| 341 |
# Launch the interface
|
| 342 |
demo.launch()
|
|
|
|
| 36 |
USE_INTERFACE = True # Change to False if you want to run the code without the Gradio interface, and instead see a single pre-supplied question
|
| 37 |
filepath = '2023_investment_outlook.docx'
|
| 38 |
# Path to document containing domain content. Initial cleaning of domain content
|
| 39 |
+
# can be done inside (eg, using Python) or outside (eg, using Word) this program,
|
| 40 |
# depending on needs and circumstances.
|
| 41 |
# emb_filepath = 'PATH HERE' # Path to document containing saved content embeddings, if applicable
|
| 42 |
COMPLETIONS_MODEL = "text-davinci-003"
|
| 43 |
+
# Get the value of confidential OpenAI API key; register at OpenAI for keys
|
|
|
|
|
|
|
| 44 |
openai.api_key = os.environ["API-KEY"]
|
| 45 |
MODEL_NAME = "curie"
|
| 46 |
DOC_EMBEDDINGS_MODEL = f"text-search-{MODEL_NAME}-doc-001"
|
|
|
|
| 332 |
outputs=gr.Textbox(lines=2, label="Answer"),
|
| 333 |
description="Example of a domain-specific chatbot, using ChatGPT with supplemental content added.<br>\
|
| 334 |
Here, the content relates to the investment outlook for 2023, according to Morgan Stanley, JPMorgan and Goldman Sachs.<br>\
|
| 335 |
+
Sample queries: What is Goldman's outlook for inflation? What about the bond market? What does JPMorgan think about 2023?<br>\
|
| 336 |
+
NOTE: High-level demo only. Supplemental content used here limited to about 30 paragraphs, due to limits on free-of-charge usage of ChatGPT.<br>\
|
| 337 |
+
More robust domain-specific responses are possible.",
|
| 338 |
title="Domain-Specific Chatbot",)
|
| 339 |
# Launch the interface
|
| 340 |
demo.launch()
|