-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7663f5d
Showing
4 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"access_token": "your token" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from revChatGPT.V1 import Chatbot | ||
import gradio as gr | ||
import json | ||
|
||
print(f'[INFO] Loading Config...') | ||
with open('config.json', 'r') as f: | ||
config = json.load(f) | ||
print(config) | ||
|
||
print(f'[INFO] Initializing Chatbot API...') | ||
chatbot = Chatbot(config=config) | ||
|
||
def submit(x): | ||
for data in chatbot.ask(x): | ||
message = data["message"] | ||
return message | ||
|
||
print(f'[INFO] Warming up chatgpt to behave as an English writing improver...') | ||
|
||
init_prompt = """ | ||
I would like to engage your services as an academic writing consultant to improve my writing. | ||
I will provide you with text that requires refinement, and you will enhance it with more academic language and sentence structures. | ||
The essence of the text should remain unaltered, including any LaTeX commands. | ||
I request that you provide only the improved version of the text without any further explanations. | ||
""" | ||
|
||
response = submit(init_prompt) | ||
|
||
print(f'[INFO] Warming up: \n{response}') | ||
|
||
print(f'[INFO] Starting Gradio APP...') | ||
|
||
with gr.Blocks() as app: | ||
gr.Markdown("### ChatGPT, please help to improve my paper writing!") | ||
|
||
with gr.Row(): | ||
|
||
text_input = gr.Textbox(label="Input", lines=10) | ||
text_output = gr.Textbox(label="Output", lines=10) | ||
|
||
text_button = gr.Button("Submit") | ||
text_button.click(submit, inputs=text_input, outputs=text_output) | ||
|
||
app.launch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## ChatGPT, please help to improve my paper writing! | ||
|
||
A thin wrapper of chatgpt with a gradio interface for improving academic writing. | ||
|
||
The initialization prompt (also rewritten with chatgpt): | ||
``` | ||
I would like to engage your services as an academic writing consultant to improve my writing. | ||
I will provide you with text that requires refinement, and you will enhance it with more academic language and sentence structures. | ||
The essence of the text should remain unaltered, including any LaTeX commands. | ||
I request that you provide only the improved version of the text without any further explanations. | ||
``` | ||
|
||
### Usage | ||
```bash | ||
### install | ||
git clone https://github.com/ashawkey/chatgpt_please_improve_my_paper_writing.git | ||
cd chatgpt_please_improve_my_paper_writing | ||
pip install -r requirements.txt | ||
|
||
### create a config.json and put your email/password/access_token into it. | ||
# please refer to https://github.com/acheong08/ChatGPT for a valid config. | ||
# usually the access_token from https://chat.openai.com/api/auth/session is enough. | ||
cp config_example.json config.json | ||
|
||
### run gradio | ||
python main.py | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
revChatGPT | ||
gradio |