Spaces:
Runtime error
Runtime error
anagri
commited on
Commit
·
86f0b5f
1
Parent(s):
a490fc1
[Amir] having prefilled values
Browse files
app.py
CHANGED
|
@@ -2,9 +2,17 @@ import streamlit as st
|
|
| 2 |
import cohere
|
| 3 |
import os
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
co = cohere.Client(os.getenv('COHERE_API_KEY'))
|
| 6 |
|
| 7 |
# Initialization
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
def generate_hashtags(input):
|
| 10 |
if len(input) == 0:
|
|
@@ -34,7 +42,17 @@ def generate_hashtags(input):
|
|
| 34 |
st.title('Positive Reframing Generator')
|
| 35 |
st.write('''This is a simple **Streamlit** app that generates the input sentence with a positive spin to it''')
|
| 36 |
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
category = st.radio(
|
| 40 |
"Please select a category",
|
|
|
|
| 2 |
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
|
| 13 |
+
def fill_example_caption(**kwargs):
|
| 14 |
+
print(f"Called with {kwargs}")
|
| 15 |
+
print(f"selectbox {prompt}")
|
| 16 |
|
| 17 |
def generate_hashtags(input):
|
| 18 |
if len(input) == 0:
|
|
|
|
| 42 |
st.title('Positive Reframing Generator')
|
| 43 |
st.write('''This is a simple **Streamlit** app that generates the input sentence with a positive spin to it''')
|
| 44 |
|
| 45 |
+
prompts = ["Choose"] + list(EXAMPLES.keys())
|
| 46 |
+
prompt = st.selectbox(
|
| 47 |
+
'Examples (select from this list)',
|
| 48 |
+
prompts,
|
| 49 |
+
index=0,
|
| 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",
|