Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,20 +3,31 @@ import requests
|
|
| 3 |
import time
|
| 4 |
import os
|
| 5 |
import json
|
|
|
|
| 6 |
|
| 7 |
genai.configure(
|
| 8 |
api_key=os.environ['API_KEY'])
|
|
|
|
| 9 |
model = genai.GenerativeModel(
|
| 10 |
model_name='gemini-pro')
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
def bardChat(data):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
return json.dumps(respo)
|
| 17 |
|
| 18 |
def responsenew(data):
|
| 19 |
-
|
| 20 |
return bardChat(data)
|
| 21 |
|
| 22 |
|
|
|
|
| 3 |
import time
|
| 4 |
import os
|
| 5 |
import json
|
| 6 |
+
import google.generativeai as genai
|
| 7 |
|
| 8 |
genai.configure(
|
| 9 |
api_key=os.environ['API_KEY'])
|
| 10 |
+
|
| 11 |
model = genai.GenerativeModel(
|
| 12 |
model_name='gemini-pro')
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
def bardChat(data):
|
| 17 |
+
prompt = data
|
| 18 |
+
|
| 19 |
+
respo = model.generate_content(
|
| 20 |
+
prompt,l
|
| 21 |
+
generation_config={
|
| 22 |
+
'temperature': 0,
|
| 23 |
+
'max_output_tokens': 800
|
| 24 |
+
}
|
| 25 |
+
)
|
| 26 |
|
| 27 |
+
return json.dumps(respo.text)
|
| 28 |
|
| 29 |
def responsenew(data):
|
| 30 |
+
|
| 31 |
return bardChat(data)
|
| 32 |
|
| 33 |
|