Spaces:
Running
Running
Add replace.py script to modify main.py
Browse files- Dockerfile +2 -3
- replace.py +10 -0
Dockerfile
CHANGED
@@ -12,6 +12,8 @@ WORKDIR /gpt
|
|
12 |
RUN git clone https://github.com/binary-husky/gpt_academic.git
|
13 |
|
14 |
COPY --chown=user:user ./config_private.py /gpt/gpt_academic/config_private.py
|
|
|
|
|
15 |
|
16 |
WORKDIR /gpt/gpt_academic
|
17 |
|
@@ -22,6 +24,3 @@ ENV WEB_PORT 7860
|
|
22 |
|
23 |
# 启动(必要)
|
24 |
CMD ["python3", "-u", "main.py"]
|
25 |
-
|
26 |
-
|
27 |
-
# CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
12 |
RUN git clone https://github.com/binary-husky/gpt_academic.git
|
13 |
|
14 |
COPY --chown=user:user ./config_private.py /gpt/gpt_academic/config_private.py
|
15 |
+
COPY --chown=user:user ./replace.py /gpt/gpt_academic/replace.py
|
16 |
+
RUN python3 replace.py
|
17 |
|
18 |
WORKDIR /gpt/gpt_academic
|
19 |
|
|
|
24 |
|
25 |
# 启动(必要)
|
26 |
CMD ["python3", "-u", "main.py"]
|
|
|
|
|
|
replace.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
with open('main.py', 'r', encoding='utf8') as file:
|
2 |
+
data = file.read()
|
3 |
+
data.replace(
|
4 |
+
"gr.HTML(title_html)",
|
5 |
+
"""gr.HTML(title_html); gr.HTML('''<center><a href="https://huggingface.co/spaces/qingxu98/gpt_academic?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>请您打开此页面后务必点击上方的“复制空间”(Duplicate Space)按钮!<font color="#FF00FF">使用时,先在输入框填入API-KEY然后回车。</font><br/>切忌在“复制空间”(Duplicate Space)之前填入API_KEY或进行提问,否则您的API_KEY将极可能被空间所有者攫取!<br/>支持任意数量的OpenAI的密钥和API2D的密钥共存,例如输入"OpenAI密钥1,API2D密钥2",然后提交,即可同时使用两种模型接口。</center>''')
|
6 |
+
"""
|
7 |
+
)
|
8 |
+
|
9 |
+
with open('main.py', 'w', encoding='utf8') as file:
|
10 |
+
file.write(data)
|