返回提交历史
Modified
phind/README.md
+3
-3
Modified
streamlit_app.py
+15
-10
XFEstudio/gpt4free
phind needs cf_clearance again
600525e5
代码差异
2 个文件
+18
-13
@@ -3,9 +3,9 @@
3
3
```python
4
4
import phind
5
5
6
# set cf_clearance cookie (not needed anymore)
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
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
9
10
10
prompt = 'who won the quatar world cup'
11
11
@@ -1,19 +1,24 @@
1
1
import streamlit as st
2
2
import phind
3
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
4
7
def phind_get_answer(question:str)->str:
5
8
# set cf_clearance cookie
6
phind.cf_clearance = 'heguhSRBB9d0sjLvGbQECS8b80m2BQ31xEmk9ChshKI-1682268995-0-160'
7
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'
8
result = phind.Completion.create(
9
model = 'gpt-4',
10
prompt = question,
11
results = phind.Search.create(question, actualSearch = True),
12
creative = False,
13
detailed = False,
14
codeContext = '')
15
return result.completion.choices[0].text
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
16
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
17
22
18
23
st.set_page_config(
19
24
page_title="gpt4freeGUI",