Spaces:
Sleeping
Sleeping
put prompt as dropdown to select from user history
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ from excel_chat import *
|
|
4 |
from classification import *
|
5 |
from chart_generation import *
|
6 |
from charts_advanced import *
|
7 |
-
|
8 |
|
9 |
|
10 |
|
@@ -84,7 +84,21 @@ df_cate = pd.DataFrame(categories)
|
|
84 |
|
85 |
|
86 |
with gr.Blocks() as demo:
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
with gr.Tab("File extraction"):
|
89 |
gr.Markdown(" Put either just a link, or a link and an excel file with an 'Actions' column")
|
90 |
with gr.Row():
|
@@ -101,7 +115,7 @@ with gr.Blocks() as demo:
|
|
101 |
with gr.Tab("Query on columns with mistral"):
|
102 |
dd_source_ask = gr.Dropdown(label="Source Column(s)", multiselect=True)
|
103 |
tb_destcol = gr.Textbox(label="Destination column label (e.g. Summary, ELI5, PAB)")
|
104 |
-
|
105 |
rd_llm = gr.Radio(["Mistral", "Claude", "Groq"], label="Choose your LLM")
|
106 |
with gr.Accordion("Filters", open=False):
|
107 |
with gr.Row():
|
@@ -140,6 +154,12 @@ with gr.Blocks() as demo:
|
|
140 |
df_output = gr.DataFrame()
|
141 |
fi_excel = gr.File(label="Excel File")
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
btn_search_status.click(extract_statuses, inputs=dd_url, outputs=dd_status)
|
144 |
btn_search.click(browse_folder, inputs=dd_url, outputs=dd_url)
|
145 |
dd_url.change(browse_folder, inputs=dd_url, outputs=dd_url)
|
@@ -147,7 +167,7 @@ with gr.Blocks() as demo:
|
|
147 |
|
148 |
btn_extract.click(extractionPrincipale, inputs=[dd_url, fi_excel, dd_status], outputs=[fi_excel, tb_message])
|
149 |
|
150 |
-
mist_button.click(chat_with_mistral, inputs=[dd_source_ask, tb_destcol,
|
151 |
|
152 |
btn_classif.click(classification, inputs=[dd_source_class, fi_excel, df_category], outputs=[fi_excel, df_output])
|
153 |
|
|
|
4 |
from classification import *
|
5 |
from chart_generation import *
|
6 |
from charts_advanced import *
|
7 |
+
from users_management import *
|
8 |
|
9 |
|
10 |
|
|
|
84 |
|
85 |
|
86 |
with gr.Blocks() as demo:
|
87 |
+
|
88 |
+
with gr.Row():
|
89 |
+
with gr.Column():
|
90 |
+
gr.Markdown("## Extaction, Classification and AI tool")
|
91 |
+
with gr.Column():
|
92 |
+
md_username = gr.Markdown()
|
93 |
+
btn_logout = gr.Button("Logout")
|
94 |
+
with gr.Accordion(label="**Login** to keep user preferences", open=False):
|
95 |
+
st_user = gr.State()
|
96 |
+
with gr.Column():
|
97 |
+
tb_user = gr.Textbox(label='Username')
|
98 |
+
tb_pwd = gr.Textbox(label='Password', type='password')
|
99 |
+
with gr.Row():
|
100 |
+
btn_login = gr.Button('Login')
|
101 |
+
|
102 |
with gr.Tab("File extraction"):
|
103 |
gr.Markdown(" Put either just a link, or a link and an excel file with an 'Actions' column")
|
104 |
with gr.Row():
|
|
|
115 |
with gr.Tab("Query on columns with mistral"):
|
116 |
dd_source_ask = gr.Dropdown(label="Source Column(s)", multiselect=True)
|
117 |
tb_destcol = gr.Textbox(label="Destination column label (e.g. Summary, ELI5, PAB)")
|
118 |
+
dd_prompt = gr.Dropdown(label="Prompt", multiselect=False, allow_custom_value=True)
|
119 |
rd_llm = gr.Radio(["Mistral", "Claude", "Groq"], label="Choose your LLM")
|
120 |
with gr.Accordion("Filters", open=False):
|
121 |
with gr.Row():
|
|
|
154 |
df_output = gr.DataFrame()
|
155 |
fi_excel = gr.File(label="Excel File")
|
156 |
|
157 |
+
# authentication
|
158 |
+
btn_login.click(auth_user, inputs=[tb_user, tb_pwd], outputs=[st_user, md_username, dd_prompt, dd_keywords])
|
159 |
+
tb_pwd.submit(auth_user, inputs=[tb_user, tb_pwd], outputs=[st_user, md_username, dd_prompt, dd_keywords])
|
160 |
+
btn_logout.click(logout, inputs=None, outputs=[st_user, md_username, dd_prompt, dd_keywords])
|
161 |
+
|
162 |
+
|
163 |
btn_search_status.click(extract_statuses, inputs=dd_url, outputs=dd_status)
|
164 |
btn_search.click(browse_folder, inputs=dd_url, outputs=dd_url)
|
165 |
dd_url.change(browse_folder, inputs=dd_url, outputs=dd_url)
|
|
|
167 |
|
168 |
btn_extract.click(extractionPrincipale, inputs=[dd_url, fi_excel, dd_status], outputs=[fi_excel, tb_message])
|
169 |
|
170 |
+
mist_button.click(chat_with_mistral, inputs=[dd_source_ask, tb_destcol, dd_prompt, fi_excel, dd_url, dd_searchcol, dd_keywords, rd_llm, st_user], outputs=[fi_excel, df_output])
|
171 |
|
172 |
btn_classif.click(classification, inputs=[dd_source_class, fi_excel, df_category], outputs=[fi_excel, df_output])
|
173 |
|