Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,18 +11,20 @@ API_TOKEN = os.getenv("API_TOKEN")
|
|
11 |
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
12 |
API_URL = "https://api-inference.huggingface.co/models/bigscience/bloom"
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
prompt="""What would this look like in 2050? Give 5 optimally describing bigrams.
|
16 |
-
Input:cake shop
|
17 |
-
Output:Sustainable ingredients,Virtual reality experience,Customizable flavor options,3D printed designs,Robotic assistants
|
18 |
-
#####
|
19 |
-
Input:consulting firm
|
20 |
-
Output:Virtual meetings,AI integration,Sustainability focus,Virtual reality simulations,Blockchain technology
|
21 |
-
#####
|
22 |
-
Input:biscuit brand
|
23 |
-
Output:Sustainable packaging,Plant-based ingredients,Digital marketing,Virtual reality,Smart packaging
|
24 |
-
#####
|
25 |
-
"""
|
26 |
|
27 |
|
28 |
def query(text):
|
|
|
11 |
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
12 |
API_URL = "https://api-inference.huggingface.co/models/bigscience/bloom"
|
13 |
|
14 |
+
DECODEM_TOKEN=os.getenv("DECODEM_TOKEN")
|
15 |
+
|
16 |
+
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
|
17 |
+
url_decodemprompts='https://us-central1-createinsightsproject.cloudfunctions.net/getdecodemprompts'
|
18 |
+
|
19 |
+
data={"prompt_type":'future_in_words',"decodem_token":DECODEM_TOKEN}
|
20 |
+
try:
|
21 |
+
r = requests.post(url_decodemprompts, data=json.dumps(data), headers=headers)
|
22 |
+
except requests.exceptions.ReadTimeout as e:
|
23 |
+
print(e)
|
24 |
+
#print(r.content)
|
25 |
+
|
26 |
+
prompt=str(r.content, 'UTF-8')
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
|
30 |
def query(text):
|