From 011d0babc265acfe35927c898a276ce8b9a261f3 Mon Sep 17 00:00:00 2001 From: "t.me/xtekky" <98614666+xtekky@users.noreply.github.com> Date: Thu, 27 Apr 2023 19:26:36 +0100 Subject: remove phind --- gui/streamlit_app.py | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'gui/streamlit_app.py') 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.' -- cgit v1.2.3