Spaces:
Paused
Paused
Commit
·
956825f
1
Parent(s):
51307f7
mnb
Browse files
app.py
CHANGED
@@ -4,6 +4,15 @@ from ask import askQuestion, getBrains
|
|
4 |
# abd="#f9fafe"
|
5 |
# abd="6469ff"
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
bg_color = "#c5dde0"
|
9 |
s_color = "#1d2230"
|
@@ -14,8 +23,9 @@ mycss = """
|
|
14 |
#advanced {{font-weight:600;background-color:#ffffff}}
|
15 |
#secondrow {{padding:0 6%;gap:30px}}
|
16 |
|
|
|
17 |
#name {{background-color: {bgcolor};border-style:none;border-width:0;box-shadow:none;padding-left:0;padding-right:0}}
|
18 |
-
#name
|
19 |
|
20 |
|
21 |
#question {{background-color: {bgcolor};border-style:none; !important;box-shadow:none !important;padding-left:0;padding-right:0}}
|
@@ -60,8 +70,8 @@ with gr.Blocks(theme=gr.themes.Soft(), css=formatted_css) as block_demo:
|
|
60 |
|
61 |
with gr.Column(scale=1, elem_id="inputsCol"):
|
62 |
|
63 |
-
|
64 |
-
label="Brain Name", elem_id="name")
|
65 |
question = gr.Textbox(
|
66 |
label="Question", lines=2, elem_id="question")
|
67 |
|
@@ -80,4 +90,6 @@ with gr.Blocks(theme=gr.themes.Soft(), css=formatted_css) as block_demo:
|
|
80 |
submit_button.click(
|
81 |
handleSubmit, [brain_name, question, temperature, maxTokens], output_text)
|
82 |
|
|
|
|
|
83 |
block_demo.launch(show_api=False)
|
|
|
4 |
# abd="#f9fafe"
|
5 |
# abd="6469ff"
|
6 |
|
7 |
+
pinecone_key=os.environ['PINECONE_KEY']
|
8 |
+
|
9 |
+
def getBrains():
|
10 |
+
pinecone.init(api_key=pinecone_key,
|
11 |
+
environment="us-west4-gcp")
|
12 |
+
active_indexes = pinecone.list_indexes()
|
13 |
+
print(active_indexes)
|
14 |
+
return gr.update(choices=active_indexes)
|
15 |
+
|
16 |
|
17 |
bg_color = "#c5dde0"
|
18 |
s_color = "#1d2230"
|
|
|
23 |
#advanced {{font-weight:600;background-color:#ffffff}}
|
24 |
#secondrow {{padding:0 6%;gap:30px}}
|
25 |
|
26 |
+
|
27 |
#name {{background-color: {bgcolor};border-style:none;border-width:0;box-shadow:none;padding-left:0;padding-right:0}}
|
28 |
+
#name .svelte-1gfkn6j {{background-color:{bgcolor};color:{scolor};font-size:18px}}
|
29 |
|
30 |
|
31 |
#question {{background-color: {bgcolor};border-style:none; !important;box-shadow:none !important;padding-left:0;padding-right:0}}
|
|
|
70 |
|
71 |
with gr.Column(scale=1, elem_id="inputsCol"):
|
72 |
|
73 |
+
brain_name = gr.Dropdown(
|
74 |
+
label="Brain Name", choices=None, elem_id="name", multiselect=False, interactive=True)
|
75 |
question = gr.Textbox(
|
76 |
label="Question", lines=2, elem_id="question")
|
77 |
|
|
|
90 |
submit_button.click(
|
91 |
handleSubmit, [brain_name, question, temperature, maxTokens], output_text)
|
92 |
|
93 |
+
block_demo.load(getBrains, [], brain_name)
|
94 |
+
|
95 |
block_demo.launch(show_api=False)
|