Dockerfile construct

This commit is contained in:
Your Name 2023-03-20 17:44:03 +08:00
parent 27d01c0890
commit 616c877dbf
3 changed files with 37 additions and 1 deletions

View File

@ -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"]

View File

@ -1,2 +1,19 @@
# 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
```

View File

@ -6,10 +6,11 @@ import requests
import importlib
import os
from config import proxies, API_URL, API_KEY
if os.path.exists('config_private.py'):
# 放自己的秘密如API和代理网址
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:
chatbot.append(('', 'Requests Timeout, Network Error.'))
yield chatbot, history, "Requests Timeout"
raise TimeoutError
token_counter = 0
partial_words = ""