Update app.py
Browse files
app.py
CHANGED
@@ -40,10 +40,10 @@ def pre_query(recipient, recipient_name, sender, context, dates, input, model_id
|
|
40 |
"parameters":{
|
41 |
"wait_for_model": True}
|
42 |
}, API_URL)
|
43 |
-
if type(data) is dict:
|
44 |
-
|
45 |
-
else:
|
46 |
-
|
47 |
|
48 |
if model_id == "bigscience/bloom":
|
49 |
input_string = "Write a professional email to my " + recipient.lower() + " starting with Hello " + recipient_name + ", about the subject " + context + " and the email should be based on this draft: " + input + ": Hello " + recipient_name + ",\n\n"
|
@@ -53,10 +53,10 @@ def pre_query(recipient, recipient_name, sender, context, dates, input, model_id
|
|
53 |
"return_full_text": False,
|
54 |
"wait_for_model": True}
|
55 |
}, API_URL)
|
56 |
-
if type(data) is dict:
|
57 |
-
|
58 |
-
else:
|
59 |
-
|
60 |
|
61 |
if model_id == "GPT-3":
|
62 |
return openai_query(recipient, 250, recipient_name, context, input)
|
|
|
40 |
"parameters":{
|
41 |
"wait_for_model": True}
|
42 |
}, API_URL)
|
43 |
+
#if type(data) is dict:
|
44 |
+
# return data['error']
|
45 |
+
#else:
|
46 |
+
return data[0]['generated_text']
|
47 |
|
48 |
if model_id == "bigscience/bloom":
|
49 |
input_string = "Write a professional email to my " + recipient.lower() + " starting with Hello " + recipient_name + ", about the subject " + context + " and the email should be based on this draft: " + input + ": Hello " + recipient_name + ",\n\n"
|
|
|
53 |
"return_full_text": False,
|
54 |
"wait_for_model": True}
|
55 |
}, API_URL)
|
56 |
+
#if type(data) is dict:
|
57 |
+
# return data['error']
|
58 |
+
#else:
|
59 |
+
return "Hello " + recipient_name + ",\n\n" + data[0]['generated_text'].replace(input_string,'')
|
60 |
|
61 |
if model_id == "GPT-3":
|
62 |
return openai_query(recipient, 250, recipient_name, context, input)
|