summaryrefslogtreecommitdiffstats
path: root/gui/streamlit_app.py
diff options
context:
space:
mode:
authort.me/xtekky <98614666+xtekky@users.noreply.github.com>2023-04-27 20:26:36 +0200
committert.me/xtekky <98614666+xtekky@users.noreply.github.com>2023-04-27 20:26:36 +0200
commit011d0babc265acfe35927c898a276ce8b9a261f3 (patch)
treedce934fe1153ec116a863baeca89a1ca590ab9bf /gui/streamlit_app.py
parentMerge branch 'main' of https://github.com/xtekky/gpt4free (diff)
downloadgpt4free-011d0babc265acfe35927c898a276ce8b9a261f3.tar
gpt4free-011d0babc265acfe35927c898a276ce8b9a261f3.tar.gz
gpt4free-011d0babc265acfe35927c898a276ce8b9a261f3.tar.bz2
gpt4free-011d0babc265acfe35927c898a276ce8b9a261f3.tar.lz
gpt4free-011d0babc265acfe35927c898a276ce8b9a261f3.tar.xz
gpt4free-011d0babc265acfe35927c898a276ce8b9a261f3.tar.zst
gpt4free-011d0babc265acfe35927c898a276ce8b9a261f3.zip
Diffstat (limited to 'gui/streamlit_app.py')
-rw-r--r--gui/streamlit_app.py21
1 files changed, 6 insertions, 15 deletions
diff --git a/gui/streamlit_app.py b/gui/streamlit_app.py
index a35196e6..4e0a618d 100644
--- a/gui/streamlit_app.py
+++ b/gui/streamlit_app.py
@@ -4,25 +4,16 @@ import sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.path.pardir))
import streamlit as st
-import phind
-
-# Set cloudflare clearance and user agent
-phind.cloudflare_clearance = ''
-phind.phind_api = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36'
-
+import you
def get_answer(question: str) -> str:
# Set cloudflare clearance cookie and get answer from GPT-4 model
try:
- result = phind.Completion.create(
- model='gpt-4',
- prompt=question,
- results=phind.Search.create(question, actualSearch=True),
- creative=False,
- detailed=False,
- codeContext=''
- )
- return result.completion.choices[0].text
+ result = you.Completion.create(
+ prompt = question)
+
+ return result['response']
+
except Exception as e:
# Return error message if an exception occurs
return f'An error occurred: {e}. Please make sure you are using a valid cloudflare clearance token and user agent.'