Spaces:
Sleeping
Sleeping
Renato Cardoso Zimmer
commited on
Commit
•
d551a1b
1
Parent(s):
5c3b6a2
Imagem e CSS
Browse filesSubindo imagem cabeçalho Hippo Beta e refatorando código python e css
- app.py +6 -108
- images/adega_hippo.png +0 -0
- src/css/styles.css +103 -0
app.py
CHANGED
@@ -11,113 +11,6 @@ p = pipeline("automatic-speech-recognition")
|
|
11 |
|
12 |
os.environ["OPENAI_API_KEY"]
|
13 |
|
14 |
-
css = """
|
15 |
-
|
16 |
-
#component-2 {position: absolute; bottom: 0; width: 100%;
|
17 |
-
}
|
18 |
-
.app.svelte-ac4rv4>.main.svelte-ac4rv4 {
|
19 |
-
display: flex;
|
20 |
-
flex-grow: 1;
|
21 |
-
flex-direction: column;
|
22 |
-
background-image: url(https://i.ibb.co/xj8R4r3/background-vertical.png);
|
23 |
-
}
|
24 |
-
div.svelte-1frtwj3 {
|
25 |
-
display: inline-flex;
|
26 |
-
align-items: center;}
|
27 |
-
|
28 |
-
div.float.svelte-1frtwj3 {
|
29 |
-
position: absolute;
|
30 |
-
opacity: 0;
|
31 |
-
top: var(--block-label-margin);
|
32 |
-
left: var(--block-label-margin);}
|
33 |
-
|
34 |
-
.wrap.svelte-6roggh.svelte-6roggh {
|
35 |
-
adding: var(--block-padding);
|
36 |
-
height: 100%;
|
37 |
-
max-height: 800px;
|
38 |
-
overflow-y: auto;
|
39 |
-
}
|
40 |
-
|
41 |
-
.bot.svelte-6roggh.svelte-6roggh, .pending.svelte-6roggh.svelte-6roggh {
|
42 |
-
border-color: var(--border-color-accent);
|
43 |
-
background-color: var(--color-accent-soft);
|
44 |
-
color: white;
|
45 |
-
font-family: initial;
|
46 |
-
font-style: italic;
|
47 |
-
font: message-box;
|
48 |
-
font-weight: bold;
|
49 |
-
}
|
50 |
-
div.svelte-1frtwj3 {
|
51 |
-
display: inline-flex;
|
52 |
-
align-items: center;
|
53 |
-
z-index: var(--layer-2);
|
54 |
-
box-shadow: var(--block-shadow);
|
55 |
-
border: var(--block-label-border-width) solid #ffffff;
|
56 |
-
border-top: none;
|
57 |
-
border-left: none;
|
58 |
-
border-radius: var(--block-label-radius);
|
59 |
-
background: #eff6ff;
|
60 |
-
padding: var(--block-label-padding);
|
61 |
-
pointer-events: none;
|
62 |
-
color: var(--block-label-text-color);
|
63 |
-
font-weight: var(--block-label-text-weight);
|
64 |
-
width: 100%;
|
65 |
-
line-height: var(--line-sm);
|
66 |
-
}
|
67 |
-
div.svelte-awbtu4 {
|
68 |
-
display: flex;
|
69 |
-
flex-direction: inherit;
|
70 |
-
flex-wrap: wrap;
|
71 |
-
gap: var(--form-gap-width);
|
72 |
-
box-shadow: var(--block-shadow);
|
73 |
-
border: var(--block-border-width) solid #5F0000;
|
74 |
-
border-radius: var(--radius-lg);
|
75 |
-
background: #ffffff;
|
76 |
-
overflow: hidden;
|
77 |
-
position: fixed;
|
78 |
-
bottom: 0;
|
79 |
-
margin-left: -16px;
|
80 |
-
}
|
81 |
-
|
82 |
-
img.svelte-ms5bsk {
|
83 |
-
width: var(--size-full);
|
84 |
-
height: 90px;
|
85 |
-
object-fit: contain;
|
86 |
-
}
|
87 |
-
.app.svelte-ac4rv4.svelte-ac4rv4 {
|
88 |
-
max-width: none;
|
89 |
-
background-color: #ffffff;
|
90 |
-
}
|
91 |
-
.app.svelte-ac4rv4.svelte-ac4rv4{max-width:none}
|
92 |
-
.wrap.svelte-1o68geq.svelte-1o68geq {max-height: none}
|
93 |
-
.block.svelte-mppz8v {
|
94 |
-
position: relative;
|
95 |
-
margin: 0;
|
96 |
-
box-shadow: var(--block-shadow);
|
97 |
-
border-width: var(--block-border-width);
|
98 |
-
border-color: white;
|
99 |
-
border-radius: var(--block-radius);
|
100 |
-
background: white;
|
101 |
-
width: 100%;
|
102 |
-
line-height: var(--line-sm);
|
103 |
-
}
|
104 |
-
div.bot.svelte-6roggh.svelte-6roggh {
|
105 |
-
background: #D9A13D;
|
106 |
-
}
|
107 |
-
div.bot.svelte-17nzccn.svelte-17nzccn {
|
108 |
-
background: #D9A13D;
|
109 |
-
}
|
110 |
-
div.user.svelte-6roggh.svelte-6roggh {
|
111 |
-
background: #5F0000;
|
112 |
-
color: white;
|
113 |
-
|
114 |
-
|
115 |
-
}
|
116 |
-
div.user.svelte-17nzccn.svelte-17nzccn {
|
117 |
-
background: #5F0000;
|
118 |
-
}
|
119 |
-
"""
|
120 |
-
|
121 |
def transcribe(audio):
|
122 |
text = p(audio)["text"]
|
123 |
return text
|
@@ -138,6 +31,11 @@ def construct_index(directory_path):
|
|
138 |
|
139 |
return index
|
140 |
|
|
|
|
|
|
|
|
|
|
|
141 |
|
142 |
def chatbot(input_text):
|
143 |
num_outputs = 4097
|
@@ -156,7 +54,7 @@ def chatbot(input_text):
|
|
156 |
|
157 |
with gr.Blocks(css=css) as demo:
|
158 |
realPath = str(os.path.dirname(os.path.realpath(__file__)))
|
159 |
-
img1 = gr.Image("images/
|
160 |
gpt = gr.Chatbot(label = ".", elem_classes=".wrap.svelte-1o68geq.svelte-1o68geq", elem_id="chatbot").style(container=True)
|
161 |
msg = gr.Textbox(elem_id="div.svelte-awbtu4",elem_classes="textBoxBot", show_label=False,
|
162 |
placeholder="Bem vindo ao Hippo Supermercados, em que posso ajuda-lo?",
|
|
|
11 |
|
12 |
os.environ["OPENAI_API_KEY"]
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
def transcribe(audio):
|
15 |
text = p(audio)["text"]
|
16 |
return text
|
|
|
31 |
|
32 |
return index
|
33 |
|
34 |
+
# Load CSS from a separate file
|
35 |
+
css_file = open("src/css/styles.css", "r")
|
36 |
+
css = css_file.read()
|
37 |
+
css_file.close()
|
38 |
+
|
39 |
|
40 |
def chatbot(input_text):
|
41 |
num_outputs = 4097
|
|
|
54 |
|
55 |
with gr.Blocks(css=css) as demo:
|
56 |
realPath = str(os.path.dirname(os.path.realpath(__file__)))
|
57 |
+
img1 = gr.Image("images/adega_hippo.png", elem_classes=".img.svelte-ms5bsk", elem_id="img.svelte-ms5bsk").style(container=False)
|
58 |
gpt = gr.Chatbot(label = ".", elem_classes=".wrap.svelte-1o68geq.svelte-1o68geq", elem_id="chatbot").style(container=True)
|
59 |
msg = gr.Textbox(elem_id="div.svelte-awbtu4",elem_classes="textBoxBot", show_label=False,
|
60 |
placeholder="Bem vindo ao Hippo Supermercados, em que posso ajuda-lo?",
|
images/adega_hippo.png
ADDED
src/css/styles.css
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#component-2 {position: absolute; bottom: 0; width: 100%;
|
2 |
+
}
|
3 |
+
.app.svelte-ac4rv4>.main.svelte-ac4rv4 {
|
4 |
+
display: flex;
|
5 |
+
flex-grow: 1;
|
6 |
+
flex-direction: column;
|
7 |
+
background-image: url(https://i.ibb.co/xj8R4r3/background-vertical.png);
|
8 |
+
}
|
9 |
+
div.svelte-1frtwj3 {
|
10 |
+
display: inline-flex;
|
11 |
+
align-items: center;}
|
12 |
+
|
13 |
+
div.float.svelte-1frtwj3 {
|
14 |
+
position: absolute;
|
15 |
+
opacity: 0;
|
16 |
+
top: var(--block-label-margin);
|
17 |
+
left: var(--block-label-margin);}
|
18 |
+
|
19 |
+
.wrap.svelte-6roggh.svelte-6roggh {
|
20 |
+
adding: var(--block-padding);
|
21 |
+
height: 100%;
|
22 |
+
max-height: 800px;
|
23 |
+
overflow-y: auto;
|
24 |
+
}
|
25 |
+
|
26 |
+
.bot.svelte-6roggh.svelte-6roggh, .pending.svelte-6roggh.svelte-6roggh {
|
27 |
+
border-color: var(--border-color-accent);
|
28 |
+
background-color: var(--color-accent-soft);
|
29 |
+
color: white;
|
30 |
+
font-family: initial;
|
31 |
+
font-style: italic;
|
32 |
+
font: message-box;
|
33 |
+
font-weight: bold;
|
34 |
+
}
|
35 |
+
div.svelte-1frtwj3 {
|
36 |
+
display: inline-flex;
|
37 |
+
align-items: center;
|
38 |
+
z-index: var(--layer-2);
|
39 |
+
box-shadow: var(--block-shadow);
|
40 |
+
border: var(--block-label-border-width) solid #ffffff;
|
41 |
+
border-top: none;
|
42 |
+
border-left: none;
|
43 |
+
border-radius: var(--block-label-radius);
|
44 |
+
background: #eff6ff;
|
45 |
+
padding: var(--block-label-padding);
|
46 |
+
pointer-events: none;
|
47 |
+
color: var(--block-label-text-color);
|
48 |
+
font-weight: var(--block-label-text-weight);
|
49 |
+
width: 100%;
|
50 |
+
line-height: var(--line-sm);
|
51 |
+
}
|
52 |
+
div.svelte-awbtu4 {
|
53 |
+
display: flex;
|
54 |
+
flex-direction: inherit;
|
55 |
+
flex-wrap: wrap;
|
56 |
+
gap: var(--form-gap-width);
|
57 |
+
box-shadow: var(--block-shadow);
|
58 |
+
border: var(--block-border-width) solid #5F0000;
|
59 |
+
border-radius: var(--radius-lg);
|
60 |
+
background: #ffffff;
|
61 |
+
overflow: hidden;
|
62 |
+
position: fixed;
|
63 |
+
bottom: 0;
|
64 |
+
margin-left: -16px;
|
65 |
+
}
|
66 |
+
|
67 |
+
img.svelte-ms5bsk {
|
68 |
+
width: var(--size-full);
|
69 |
+
height: 90px;
|
70 |
+
object-fit: contain;
|
71 |
+
}
|
72 |
+
.app.svelte-ac4rv4.svelte-ac4rv4 {
|
73 |
+
max-width: none;
|
74 |
+
background-color: #ffffff;
|
75 |
+
}
|
76 |
+
.app.svelte-ac4rv4.svelte-ac4rv4{max-width:none}
|
77 |
+
.wrap.svelte-1o68geq.svelte-1o68geq {max-height: none}
|
78 |
+
.block.svelte-mppz8v {
|
79 |
+
position: relative;
|
80 |
+
margin: 0;
|
81 |
+
box-shadow: var(--block-shadow);
|
82 |
+
border-width: var(--block-border-width);
|
83 |
+
border-color: white;
|
84 |
+
border-radius: var(--block-radius);
|
85 |
+
background: white;
|
86 |
+
width: 100%;
|
87 |
+
line-height: var(--line-sm);
|
88 |
+
}
|
89 |
+
div.bot.svelte-6roggh.svelte-6roggh {
|
90 |
+
background: #D9A13D;
|
91 |
+
}
|
92 |
+
div.bot.svelte-17nzccn.svelte-17nzccn {
|
93 |
+
background: #D9A13D;
|
94 |
+
}
|
95 |
+
div.user.svelte-6roggh.svelte-6roggh {
|
96 |
+
background: #5F0000;
|
97 |
+
color: white;
|
98 |
+
|
99 |
+
|
100 |
+
}
|
101 |
+
div.user.svelte-17nzccn.svelte-17nzccn {
|
102 |
+
background: #5F0000;
|
103 |
+
}
|