Illia56 commited on
Commit
e235e30
·
1 Parent(s): 1bf8daa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -2,7 +2,7 @@ import streamlit as st
2
  import json
3
  import os
4
  import requests
5
- from bardapi import BardAsync
6
 
7
  # Load the GOOGLE_LANGUAGES_TO_CODES dictionary from lang.json
8
  with open("lang.json", "r") as file:
@@ -21,7 +21,7 @@ with st.sidebar:
21
  selected_language_code = GOOGLE_LANGUAGES_TO_CODES[selected_language_name]
22
 
23
  # Initialize Bard with the selected language code
24
- bard = BardAsync(token=os.getenv("_BARD_API_KEY"), language=selected_language_code)
25
 
26
  TITLE = "Palm 2🌴 Chatbot"
27
  DESCRIPTION = """
@@ -34,10 +34,10 @@ st.title(TITLE)
34
  st.write(DESCRIPTION)
35
 
36
  # Prediction function
37
- async def predict(message):
38
  with st.status("Requesting Palm-2🌴..."):
39
  st.write("Requesting API...")
40
- response = await bard.get_answer(message if not (code_interpreter and useSystemPrompt) else message + " . "+system_prompt)
41
  st.write("Done...")
42
 
43
  st.write("Checking images...")
 
2
  import json
3
  import os
4
  import requests
5
+ from bardapi import Bard
6
 
7
  # Load the GOOGLE_LANGUAGES_TO_CODES dictionary from lang.json
8
  with open("lang.json", "r") as file:
 
21
  selected_language_code = GOOGLE_LANGUAGES_TO_CODES[selected_language_name]
22
 
23
  # Initialize Bard with the selected language code
24
+ bard = Bard(token=os.getenv("_BARD_API_KEY"), language=selected_language_code)
25
 
26
  TITLE = "Palm 2🌴 Chatbot"
27
  DESCRIPTION = """
 
34
  st.write(DESCRIPTION)
35
 
36
  # Prediction function
37
+ def predict(message):
38
  with st.status("Requesting Palm-2🌴..."):
39
  st.write("Requesting API...")
40
+ response = bard.get_answer(message if not (code_interpreter and useSystemPrompt) else message + " . "+system_prompt)
41
  st.write("Done...")
42
 
43
  st.write("Checking images...")