Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -76,6 +76,10 @@ import os
|
|
| 76 |
import json
|
| 77 |
import google.generativeai as genai
|
| 78 |
import random
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
genai.configure(
|
| 81 |
api_key=os.environ['API_KEY'])
|
|
@@ -92,13 +96,13 @@ def responsenew(data):
|
|
| 92 |
|
| 93 |
query = data
|
| 94 |
|
| 95 |
-
respo = model.generate_content(
|
| 96 |
-
query,
|
| 97 |
-
generation_config={
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
}
|
| 101 |
-
)
|
| 102 |
|
| 103 |
idval = random.randint(1, 1000000000)
|
| 104 |
print(f"\n\n{data}")
|
|
@@ -170,6 +174,18 @@ def responsenew(data):
|
|
| 170 |
}],
|
| 171 |
}
|
| 172 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
|
| 174 |
|
| 175 |
return json.dumps(respo)
|
|
|
|
| 76 |
import json
|
| 77 |
import google.generativeai as genai
|
| 78 |
import random
|
| 79 |
+
from getvalues import getValues
|
| 80 |
+
from datetime import datetime, timedelta
|
| 81 |
+
import uuid
|
| 82 |
+
import re
|
| 83 |
|
| 84 |
genai.configure(
|
| 85 |
api_key=os.environ['API_KEY'])
|
|
|
|
| 96 |
|
| 97 |
query = data
|
| 98 |
|
| 99 |
+
# respo = model.generate_content(
|
| 100 |
+
# query,
|
| 101 |
+
# generation_config={
|
| 102 |
+
# 'temperature': 0,
|
| 103 |
+
# 'max_output_tokens': 100
|
| 104 |
+
# }
|
| 105 |
+
# )
|
| 106 |
|
| 107 |
idval = random.randint(1, 1000000000)
|
| 108 |
print(f"\n\n{data}")
|
|
|
|
| 174 |
}],
|
| 175 |
}
|
| 176 |
}
|
| 177 |
+
else:
|
| 178 |
+
respo = {
|
| 179 |
+
"message": response.text,
|
| 180 |
+
"action": "nothing",
|
| 181 |
+
"function": "nothing",
|
| 182 |
+
}
|
| 183 |
+
else:
|
| 184 |
+
respo = {
|
| 185 |
+
"message": "Whoops, seems like we're a bit overloaded! Don't worry, your request is in the queue and we'll get back to you as soon as possible.",
|
| 186 |
+
"action": "nothing",
|
| 187 |
+
"function": "nothing",
|
| 188 |
+
}
|
| 189 |
|
| 190 |
|
| 191 |
return json.dumps(respo)
|