focusit commited on
Commit
c0f6f3e
·
1 Parent(s): e62d454

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -3,11 +3,15 @@ import requests
3
  import os
4
  import json
5
  from hugchat import hugchat
 
6
 
7
  auth = os.environ.get('Authorization')
8
  API_URL = "https://api-inference.huggingface.co/models/google/flan-t5-xl"
9
  headers = {"Authorization": auth}
10
 
 
 
 
11
 
12
 
13
  def huggChat(data):
@@ -25,6 +29,10 @@ def huggChat(data):
25
  print(result)
26
  return 'Hello Sir'
27
 
 
 
 
 
28
  def query(payload):
29
  response = requests.post(API_URL, headers=headers, json=payload)
30
 
@@ -34,7 +42,8 @@ def query(payload):
34
 
35
 
36
  def responsenew(data):
37
- return huggChat(data)
 
38
  #return query({"inputs": "The answer to the universe is",})
39
 
40
 
 
3
  import os
4
  import json
5
  from hugchat import hugchat
6
+ from bardapi import Bard
7
 
8
  auth = os.environ.get('Authorization')
9
  API_URL = "https://api-inference.huggingface.co/models/google/flan-t5-xl"
10
  headers = {"Authorization": auth}
11
 
12
+ #Replace XXXX with the values you get from __Secure-1PSID
13
+ os.environ['_BARD_API_KEY']="XXXX"
14
+
15
 
16
 
17
  def huggChat(data):
 
29
  print(result)
30
  return 'Hello Sir'
31
 
32
+ def bardChat(data):
33
+
34
+ print(Bard().get_answer(data)['content'])
35
+
36
  def query(payload):
37
  response = requests.post(API_URL, headers=headers, json=payload)
38
 
 
42
 
43
 
44
  def responsenew(data):
45
+ return bardChat(data)
46
+ #return huggChat(data)
47
  #return query({"inputs": "The answer to the universe is",})
48
 
49