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/README.md | 8 +++++--- gui/streamlit_app.py | 21 ++++++--------------- 2 files changed, 11 insertions(+), 18 deletions(-) (limited to 'gui') diff --git a/gui/README.md b/gui/README.md index 379cf155..133abe4b 100644 --- a/gui/README.md +++ b/gui/README.md @@ -1,9 +1,11 @@ # gpt4free gui -preview: +mode `streamlit_app.py` into base folder to run + +preview: image - -run: + +run: image 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