Dockerfile construct
This commit is contained in:
parent
27d01c0890
commit
616c877dbf
17
Dockerfile
17
Dockerfile
@ -0,0 +1,17 @@
|
|||||||
|
FROM ubuntu:latest
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y python3 python3-pip && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN echo '[global]' > /etc/pip.conf && \
|
||||||
|
echo 'index-url = https://mirrors.aliyun.com/pypi/simple/' >> /etc/pip.conf && \
|
||||||
|
echo 'trusted-host = mirrors.aliyun.com' >> /etc/pip.conf
|
||||||
|
|
||||||
|
RUN pip3 install gradio requests[socks] mdtex2html
|
||||||
|
|
||||||
|
COPY . /gpt
|
||||||
|
WORKDIR /gpt
|
||||||
|
|
||||||
|
|
||||||
|
CMD ["python3", "main.py"]
|
17
README.md
17
README.md
@ -1,2 +1,19 @@
|
|||||||
# ChatGPT 学术优化
|
# ChatGPT 学术优化
|
||||||
|
|
||||||
|
## 使用docker
|
||||||
|
|
||||||
|
``` sh
|
||||||
|
# 构建镜像
|
||||||
|
docker build -t gpt-academic .
|
||||||
|
# 运行
|
||||||
|
docker run --rm -it --net=host gpt-academic
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## 参考项目
|
||||||
|
```
|
||||||
|
https://github.com/Python-Markdown/markdown
|
||||||
|
https://github.com/gradio-app/gradio
|
||||||
|
https://github.com/polarwinkel/mdtex2html
|
||||||
|
https://github.com/GaiZhenbiao/ChuanhuChatGPT
|
||||||
|
```
|
||||||
|
@ -6,10 +6,11 @@ import requests
|
|||||||
import importlib
|
import importlib
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from config import proxies, API_URL, API_KEY
|
|
||||||
if os.path.exists('config_private.py'):
|
if os.path.exists('config_private.py'):
|
||||||
# 放自己的秘密如API和代理网址
|
# 放自己的秘密如API和代理网址
|
||||||
from config_private import proxies, API_URL, API_KEY
|
from config_private import proxies, API_URL, API_KEY
|
||||||
|
else:
|
||||||
|
from config import proxies, API_URL, API_KEY
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -90,6 +91,7 @@ def predict(inputs, top_p, temperature, chatbot=[], history=[], system_prompt=''
|
|||||||
except:
|
except:
|
||||||
chatbot.append(('', 'Requests Timeout, Network Error.'))
|
chatbot.append(('', 'Requests Timeout, Network Error.'))
|
||||||
yield chatbot, history, "Requests Timeout"
|
yield chatbot, history, "Requests Timeout"
|
||||||
|
raise TimeoutError
|
||||||
|
|
||||||
token_counter = 0
|
token_counter = 0
|
||||||
partial_words = ""
|
partial_words = ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user