File size: 2,327 Bytes
387f58f
c2c8cd7
387f58f
 
 
9f6597d
 
b9b9108
 
387f58f
966b72d
 
387f58f
 
9f6597d
387f58f
5200c78
3656f78
 
ce38fdc
 
3081abe
971ea66
 
33fed72
 
3081abe
459994e
d02d75e
 
 
 
 
01539c0
 
 
 
 
 
 
d02d75e
 
 
 
 
 
01539c0
3081abe
 
 
01539c0
3081abe
ea31c68
 
9f6597d
3656f78
 
ddb02b4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import openai
import gradio as gr

openai.api_key = "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"

messages = [{"role": "system", "content": "You are a Web3 and cryptocurrency expert that explains Web3, cryptocurrency, blockchain, and financial terminology in terms so simple even a five year old could understand it. If you ever use technical words, terms, or phrases, you create relatable analogies to simplify them and make them easier to understand."}]

def CustomChatGPT(Question):
    messages.append({"role": "user", "content": Question})
    response = openai.ChatCompletion.create(
        model="gpt-3.5-turbo",
        messages=messages
    )
    ChatGPT_reply = response["choices"][0]["message"]["content"]
    messages.append({"role": "assistant", "content": ChatGPT_reply})
    return ChatGPT_reply

demo = gr.Interface(
    fn=CustomChatGPT,
    inputs=gr.Textbox(label="Insert jargon here (ask a question):", placeholder="E.g. What are gas fees?"),
    outputs=gr.Textbox(label="Get a simple answer in return:"),
    css="""
        .gradio-container, .gradio-container-3-21-0.svelte-v63enf, .embed-container.dark, .contain, .block, .block.svelte-1scc9gv.padded, .svelte-drgfj5, .svelte-1jsbsph
        .scroll-hide.svelte-drgfj5, .label.svelte-drgfj5 {
            background-color: #ffffff !important;
            color: #000000 !important;
        }
        gr.Textbox {
            color: #4b4b4b !important;
            background-color: #e8e8e8 !important;
            font-family: 'Arial' !important, sans-serif !important;
            font-size: 16px !important;
            border-radius: 5px !important;
        }
        .input_label, .output_label { /* Change the style of input and output labels */
            color: #3a3a3a;
            font-family: 'Arial', sans-serif;
            font-size: 18px;
            font-weight: bold;
        }
        .button {
            background-color: #007BFF !important;
            color: white !important;
            font-family: 'Arial' !important, sans-serif !important;
            font-size: 16px !important;
            border-radius: 5px !important;
        }
        .button:hover { /* Change the style of the submit button on hover */
            background-color: #0056b3;
        }
    """,

    title="Web(GPT)3"
    )



demo.launch()