Commit
·
3e1cc4e
1
Parent(s):
7cec07d
Update app.py
Browse files
app.py
CHANGED
@@ -6,13 +6,13 @@ openai.organization = os.environ.get('ORGANIZATION')
|
|
6 |
openai.api_key = os.environ.get('API_KEY')
|
7 |
|
8 |
def classificate_with_gpt3(text, labels, engine="text-similarity-davinci-001"):
|
9 |
-
prompt = f"""The following text inside one of this categories: {labels}
|
10 |
|
11 |
{text}
|
12 |
|
13 |
Category:"""
|
14 |
response = openai.Completion.create(
|
15 |
-
model=engine
|
16 |
prompt=prompt,
|
17 |
temperature=0.7,
|
18 |
max_tokens=1000,
|
@@ -45,7 +45,7 @@ with gr.Blocks(css=".gradio-container { background-color: white; }") as demo:
|
|
45 |
[ "On 22 February 2014, Ukrainian president Viktor Yanukovych was ousted from office as a result of the Euromaidan and the Revolution of Dignity, which broke out after his decision to reject the European Union–Ukraine Association Agreement and instead pursue closer ties with Russia and the Eurasian Economic Union. Shortly after Yanukovych's overthrow and exile to Russia, Ukraine's eastern and southern regions erupted with pro-Russia unrest.", "Entertainment, Business, Politics" ],
|
46 |
[ "This dull recreation of the animated film doesn’t strive for anything more than what was contained in the original version of this film and actually delivers less.", "Entertainment, Business, Politics" ],
|
47 |
[ "The third beta of iOS 16.1 that was released earlier this week expands the Adaptive Transparency feature introduced with the second-generation AirPods Pro to the original AirPods Pro.", "Entertainment, Business, Politics" ],
|
48 |
-
[ "
|
49 |
],
|
50 |
[context, threshold],
|
51 |
fn=gpt3_zero_shot_classification
|
|
|
6 |
openai.api_key = os.environ.get('API_KEY')
|
7 |
|
8 |
def classificate_with_gpt3(text, labels, engine="text-similarity-davinci-001"):
|
9 |
+
prompt = f"""The following text may fall inside one of this categories: {labels}, None
|
10 |
|
11 |
{text}
|
12 |
|
13 |
Category:"""
|
14 |
response = openai.Completion.create(
|
15 |
+
model=engine,
|
16 |
prompt=prompt,
|
17 |
temperature=0.7,
|
18 |
max_tokens=1000,
|
|
|
45 |
[ "On 22 February 2014, Ukrainian president Viktor Yanukovych was ousted from office as a result of the Euromaidan and the Revolution of Dignity, which broke out after his decision to reject the European Union–Ukraine Association Agreement and instead pursue closer ties with Russia and the Eurasian Economic Union. Shortly after Yanukovych's overthrow and exile to Russia, Ukraine's eastern and southern regions erupted with pro-Russia unrest.", "Entertainment, Business, Politics" ],
|
46 |
[ "This dull recreation of the animated film doesn’t strive for anything more than what was contained in the original version of this film and actually delivers less.", "Entertainment, Business, Politics" ],
|
47 |
[ "The third beta of iOS 16.1 that was released earlier this week expands the Adaptive Transparency feature introduced with the second-generation AirPods Pro to the original AirPods Pro.", "Entertainment, Business, Politics" ],
|
48 |
+
[ "To make this into soup, bring 3 1/2 cups water to a boil in a medium saucepan. Whisk in soup mix, reduce heat to low, and simmer for 5 minutes.", "Entertainment, Business, Politics" ]
|
49 |
],
|
50 |
[context, threshold],
|
51 |
fn=gpt3_zero_shot_classification
|