forked from shreyashankar/gpt3-sandbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a separate endpoint to handle examples.
Examples are handled by the /example endpoint. This commit also unifies the python code examples and the ones created in UI.
- Loading branch information
Showing
5 changed files
with
127 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
import os | ||
import sys | ||
|
||
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) | ||
|
||
from api import GPT, Example, UIConfig | ||
from api import demo_web_app | ||
|
||
|
||
# Construct GPT object and show some examples | ||
gpt = GPT(engine="davinci", | ||
temperature=0.5, | ||
max_tokens=100) | ||
gpt = GPT(engine="davinci", temperature=0.5, max_tokens=100) | ||
|
||
gpt.add_example(Example("Who are you?", "I'm an example.")) | ||
gpt.add_example(Example("What are you?", "I'm an example.")) | ||
|
||
# Define UI configuration | ||
config = UIConfig(description="Prompt", | ||
button_text="Result", | ||
placeholder="Where is Mt. Rushmore ?", | ||
show_example_form=True) | ||
config = UIConfig( | ||
description="Prompt", | ||
button_text="Result", | ||
placeholder="Where are you?", | ||
show_example_form=True, | ||
) | ||
|
||
demo_web_app(gpt, config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters