Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,17 +11,19 @@ API_TOKEN = os.getenv("API_TOKEN")
|
|
| 11 |
from huggingface_hub import InferenceApi
|
| 12 |
inference = InferenceApi("bigscience/bloom",token=API_TOKEN)
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
| 25 |
|
| 26 |
def infer(prompt,
|
| 27 |
max_length = 250,
|
|
|
|
| 11 |
from huggingface_hub import InferenceApi
|
| 12 |
inference = InferenceApi("bigscience/bloom",token=API_TOKEN)
|
| 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":'devils_advocate',"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 |
def infer(prompt,
|
| 29 |
max_length = 250,
|