AITECHPRODUCTS/githubtest
0
1# gradio-chatgpt2 3This repository provides a simple web-based interface for ChatGPT. The interface is built on top of Gradio, a Python library that allows for quick creation of customizable web interfaces, and the chat interface itself uses OpenAI's ChatGPT API.4 5<img src="screenshot.png" title="screenshot" width="450"/>6 7# How to use8 9To use this wrapper, you must have a valid OpenAI API key. You can obtain one from OpenAI [here](https://platform.openai.com/account/api-keys).10 11Once you have your API key, clone this repository to your local machine and navigate to the repository directory. Put the key in the file `openai_api_key`.12 13Make sure that you have installed all the dependencies by running the following command:14```15pip install -r requirements.txt16```17 18To start the server, simply run the `server.py` file which can be done using the `start_server.sh` script:19```20python server.py21```22 23You can then access the service at http://127.0.0.1:7860 via any web browser. A public link would be also generated, which expires in 72 hours.24 25# The wrapper of `openai.ChatCompletion`26We have also included a user-friendly Python wrapper for ChatGPT. For example, you can use it in the following way:27 28```python29from chat_completion import ChatCompletion30c = ChatCompletion(api_key_path='./openai_api_key')31```32 33```python34c.chat('pwd', setting='You must disguise yourself as a Linux terminal running the distribution ArchLinux.')35```36'/home/user/NotArchLinux/ # It looks like you are not in the ArchLinux distribution.'37 38```python39c.retry()40```41'/home/archlinux'42 43```python44c.chat('cat /etc/arch-release')45```46Welcome to ArchLinux! You are running version 5.3.12-arch1-1.47My terminal prompt is48 49[your_username@arch ~]$