trttung1610 commited on
Commit
3eed6e5
·
1 Parent(s): 9586d7c

Upload 2 files

Browse files
Files changed (2) hide show
  1. health.py +43 -0
  2. style.css +16 -0
health.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import openai
3
+
4
+ DESCRIPTION = """
5
+ Hãy để trợ lý của AI Consultant hỗ trợ bạn !
6
+ """
7
+
8
+ # Define inputs and outputs
9
+ inputs = [
10
+ gr.inputs.Textbox(label="Câu hỏi:"),
11
+ ]
12
+
13
+ outputs = [
14
+ gr.outputs.Textbox(label="Câu trả lời:")
15
+ ]
16
+
17
+ def chatbot(input):
18
+ openai.api_key = API_KEY
19
+
20
+ response = openai.Completion.create(
21
+ engine="text-davinci-003",
22
+ prompt=input,
23
+ max_tokens=60
24
+ )
25
+
26
+ return response.choices[0].text.strip()
27
+
28
+ # Create a Gradio interface with title, logo, and caption
29
+
30
+ interface = gr.Interface(
31
+ fn=chatbot,
32
+ inputs=inputs,
33
+ outputs=outputs,
34
+ title="AI Consultant", # Add the title here
35
+ theme="compact", # You can adjust the theme as needed
36
+ layout="vertical", # You can adjust the layout as needed
37
+ allow_flagging="never",
38
+ live=False, # Set live to False to display the title, logo, and caption immediately
39
+ description=DESCRIPTION, # Update the description here
40
+ css='style.css'
41
+ )
42
+ # Launch the interface
43
+ interface.launch()
style.css ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ h1 {
2
+ text-align: center;
3
+ }
4
+
5
+ #duplicate-button {
6
+ margin: auto;
7
+ color: white;
8
+ background: #1565c0;
9
+ border-radius: 100vh;
10
+ }
11
+
12
+ #component-0 {
13
+ max-width: 900px;
14
+ margin: auto;
15
+ padding-top: 1.5rem;
16
+ }