t.me/xtekky
commited on
Commit
·
600525e
1
Parent(s):
1520d8c
phind needs cf_clearance again
Browse files- phind/README.md +3 -3
- streamlit_app.py +15 -10
phind/README.md
CHANGED
@@ -3,9 +3,9 @@
|
|
3 |
```python
|
4 |
import phind
|
5 |
|
6 |
-
# set cf_clearance cookie (
|
7 |
-
|
8 |
-
|
9 |
|
10 |
prompt = 'who won the quatar world cup'
|
11 |
|
|
|
3 |
```python
|
4 |
import phind
|
5 |
|
6 |
+
# set cf_clearance cookie (needed again)
|
7 |
+
phind.cf_clearance = 'xx.xx-1682166681-0-160'
|
8 |
+
phind.user_agent = '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' # same as the one from browser you got cf_clearance from
|
9 |
|
10 |
prompt = 'who won the quatar world cup'
|
11 |
|
streamlit_app.py
CHANGED
@@ -1,19 +1,24 @@
|
|
1 |
import streamlit as st
|
2 |
import phind
|
3 |
|
|
|
|
|
|
|
4 |
def phind_get_answer(question:str)->str:
|
5 |
# set cf_clearance cookie
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
|
|
|
|
|
17 |
|
18 |
st.set_page_config(
|
19 |
page_title="gpt4freeGUI",
|
|
|
1 |
import streamlit as st
|
2 |
import phind
|
3 |
|
4 |
+
phind.cf_clearance = ''
|
5 |
+
phind.user_agent = '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'
|
6 |
+
|
7 |
def phind_get_answer(question:str)->str:
|
8 |
# set cf_clearance cookie
|
9 |
+
try:
|
10 |
+
|
11 |
+
result = phind.Completion.create(
|
12 |
+
model = 'gpt-4',
|
13 |
+
prompt = question,
|
14 |
+
results = phind.Search.create(question, actualSearch = True),
|
15 |
+
creative = False,
|
16 |
+
detailed = False,
|
17 |
+
codeContext = '')
|
18 |
+
return result.completion.choices[0].text
|
19 |
|
20 |
+
except Exception as e:
|
21 |
+
return 'An error occured, please make sure you are using a cf_clearance token and correct useragent | %s' % e
|
22 |
|
23 |
st.set_page_config(
|
24 |
page_title="gpt4freeGUI",
|