Spaces:
Runtime error
Runtime error
anagri
commited on
Commit
·
53d6b99
1
Parent(s):
86f0b5f
[Amir] having prompt and category filled on selection
Browse files
app.py
CHANGED
@@ -3,10 +3,13 @@ import cohere
|
|
3 |
import os
|
4 |
|
5 |
|
|
|
6 |
EXAMPLES = {
|
7 |
-
"I lost my Job": ("I lost my Job."),
|
8 |
-
"I lost my Dog": ("I lost my Dog."),
|
9 |
}
|
|
|
|
|
10 |
co = cohere.Client(os.getenv('COHERE_API_KEY'))
|
11 |
|
12 |
# Initialization
|
@@ -50,13 +53,17 @@ prompt = st.selectbox(
|
|
50 |
)
|
51 |
if prompt == "Choose":
|
52 |
input_val = ""
|
|
|
53 |
else:
|
54 |
-
input_val = EXAMPLES[prompt]
|
|
|
55 |
input = st.text_area('Enter your post title caption or select from examples', input_val, height=100)
|
56 |
|
57 |
category = st.radio(
|
58 |
"Please select a category",
|
59 |
-
|
|
|
|
|
60 |
|
61 |
if st.button('Reframe'):
|
62 |
output = generate_hashtags(input)
|
|
|
3 |
import os
|
4 |
|
5 |
|
6 |
+
# 'growth', 'remove_negations', 'self_affirmation'
|
7 |
EXAMPLES = {
|
8 |
+
"I lost my Job": ("I lost my Job.", 'growth'),
|
9 |
+
"I lost my Dog": ("I lost my Dog.", 'self_affirmation'),
|
10 |
}
|
11 |
+
categories = ['growth', 'remove_negations', 'self_affirmation']
|
12 |
+
|
13 |
co = cohere.Client(os.getenv('COHERE_API_KEY'))
|
14 |
|
15 |
# Initialization
|
|
|
53 |
)
|
54 |
if prompt == "Choose":
|
55 |
input_val = ""
|
56 |
+
input_cat = categories[0]
|
57 |
else:
|
58 |
+
input_val = EXAMPLES[prompt][0]
|
59 |
+
input_cat = EXAMPLES[prompt][1]
|
60 |
input = st.text_area('Enter your post title caption or select from examples', input_val, height=100)
|
61 |
|
62 |
category = st.radio(
|
63 |
"Please select a category",
|
64 |
+
categories,
|
65 |
+
categories.index(input_cat),
|
66 |
+
)
|
67 |
|
68 |
if st.button('Reframe'):
|
69 |
output = generate_hashtags(input)
|