Spaces:
Sleeping
Sleeping
Commit
β’
5617e5f
0
Parent(s):
Duplicate from dylanmeca/chatgpt-python
Browse filesCo-authored-by: Dylan Alexander <dylanmeca@users.noreply.huggingface.co>
- .gitattributes +34 -0
- README.md +30 -0
- app.py +24 -0
- requirements.txt +2 -0
.gitattributes
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Chatgpt Python
|
3 |
+
emoji: π
|
4 |
+
colorFrom: indigo
|
5 |
+
colorTo: blue
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.18.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
license: gpl-3.0
|
11 |
+
python_version: 3.8.9
|
12 |
+
tags:
|
13 |
+
- chatgpt
|
14 |
+
- gpt3
|
15 |
+
- gpt-3
|
16 |
+
- chatbot
|
17 |
+
- chat
|
18 |
+
- bot
|
19 |
+
- chatgpt3
|
20 |
+
- gpt
|
21 |
+
duplicated_from: dylanmeca/chatgpt-python
|
22 |
+
---
|
23 |
+
|
24 |
+
# π€ ChatGPT-Python π
|
25 |
+
[![Build Status](https://img.shields.io/github/stars/dylanmeca/ChatGPT-Python.svg)](https://github.com/dylanmeca/ChatGPT-Python)
|
26 |
+
[![License](https://img.shields.io/github/license/dylanmeca/ChatGPT-Python.svg)](https://github.com/dylanmeca/ChatGPT-Python/blob/main/LICENSE)
|
27 |
+
[![dylanmeca](https://img.shields.io/badge/author-dylanmeca-green.svg)](https://github.com/dylanmeca)
|
28 |
+
[![Python](https://img.shields.io/badge/language-Python%20-yellow.svg)](https://www.python.org)
|
29 |
+
|
30 |
+
ChatGPT-Python is a software that allows you to use ChatGPT from python through a web interface, using the OpenAI API.
|
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import openai
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
# Getting responses using the OpenAI API
|
5 |
+
def response_chatgpt(api_key, message):
|
6 |
+
# OPENAI API KEY
|
7 |
+
openai.api_key = api_key
|
8 |
+
prompt = (f"{message}")
|
9 |
+
response = openai.Completion.create(
|
10 |
+
engine="text-davinci-003",
|
11 |
+
prompt=prompt,
|
12 |
+
max_tokens=1024
|
13 |
+
)
|
14 |
+
# Displaying the answer on the screen
|
15 |
+
result = response["choices"][0]["text"]
|
16 |
+
return result
|
17 |
+
|
18 |
+
# User input
|
19 |
+
chatbot = gr.Interface(
|
20 |
+
fn=response_chatgpt,
|
21 |
+
inputs=["text", "text"],
|
22 |
+
outputs="text",
|
23 |
+
)
|
24 |
+
chatbot.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
openai
|
2 |
+
gradio
|