summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/README.md8
-rw-r--r--gui/streamlit_app.py21
2 files changed, 11 insertions, 18 deletions
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:
<img width="1125" alt="image" src="https://user-images.githubusercontent.com/98614666/234232398-09e9d3c5-08e6-4b8a-b4f2-0666e9790c7d.png">
-
-run:
+
+run:
<img width="724" alt="image" src="https://user-images.githubusercontent.com/98614666/234232449-0d5cd092-a29d-4759-8197-e00ba712cb1a.png">
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.'