Create AI Azure Architect
Browse files- .github/workflows/main.yml +4 -1
- README.md +1 -0
- app.py +21 -17
- scripts/00_DataCollection.md +3 -1
.github/workflows/main.yml
CHANGED
@@ -14,7 +14,10 @@ jobs:
|
|
14 |
with:
|
15 |
fetch-depth: 0
|
16 |
lfs: true
|
|
|
|
|
17 |
- name: Push to hub
|
18 |
env:
|
19 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
20 |
-
run: git push https://vicpada:$HF_TOKEN@huggingface.co/spaces/vicpada/ai-microsoft-solution-architect main
|
|
|
|
14 |
with:
|
15 |
fetch-depth: 0
|
16 |
lfs: true
|
17 |
+
- name: filter out images
|
18 |
+
run: git filter-branch --force --index-filter "git rm --cached --ignore-unmatch *.png" --prune-empty --tag-name-filter cat -- --all
|
19 |
- name: Push to hub
|
20 |
env:
|
21 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
22 |
+
run: git push -f https://vicpada:$HF_TOKEN@huggingface.co/spaces/vicpada/ai-microsoft-solution-architect main
|
23 |
+
|
README.md
CHANGED
@@ -7,6 +7,7 @@ sdk: gradio
|
|
7 |
sdk_version: "4.44.1"
|
8 |
app_file: app.py
|
9 |
pinned: false
|
|
|
10 |
---
|
11 |
|
12 |
# Starting Point for the Final Project of the "From Beginner to Advanced LLM Developer" course
|
|
|
7 |
sdk_version: "4.44.1"
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
+
license: mit
|
11 |
---
|
12 |
|
13 |
# Starting Point for the Final Project of the "From Beginner to Advanced LLM Developer" course
|
app.py
CHANGED
@@ -193,19 +193,28 @@ def generate_completion(query, history, memory, openAI_api_key, cohere_api_key):
|
|
193 |
|
194 |
def launch_ui():
|
195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
|
197 |
with gr.Blocks(
|
198 |
fill_height=True,
|
199 |
title="AI Azure Architect 🤖",
|
200 |
analytics_enabled=True,
|
201 |
-
) as demo:
|
202 |
-
|
203 |
-
|
204 |
-
openai_key_tb = gr.Textbox(
|
205 |
-
visible=True,
|
206 |
-
label="OpenAI API Key",
|
207 |
-
placeholder="Enter your OpenAI API Key here (e.g., sk-...)",
|
208 |
-
)
|
209 |
|
210 |
def onOpenAIKeyChange(x):
|
211 |
# Validate the OpenAI API Key format
|
@@ -221,16 +230,10 @@ def launch_ui():
|
|
221 |
logging.info(f"OpenAI API Key set: {x is not None}")
|
222 |
|
223 |
openai_key_tb.change(
|
224 |
-
|
225 |
inputs=openai_key_tb,
|
226 |
outputs=None,
|
227 |
-
)
|
228 |
-
|
229 |
-
cohere_key_tb = gr.Textbox(
|
230 |
-
visible=True,
|
231 |
-
label="Cohere API Key",
|
232 |
-
placeholder="Enter your Cohere API Key here",
|
233 |
-
)
|
234 |
|
235 |
def onCohereKeyChange(x):
|
236 |
# Validate the Cohere API Key format
|
@@ -259,9 +262,10 @@ def launch_ui():
|
|
259 |
)
|
260 |
|
261 |
gr.ChatInterface(
|
262 |
-
fn=generate_completion,
|
263 |
chatbot=chatbot,
|
264 |
additional_inputs=[memory_state, openai_key_tb, cohere_key_tb],
|
|
|
265 |
)
|
266 |
|
267 |
demo.queue(default_concurrency_limit=64)
|
|
|
193 |
|
194 |
def launch_ui():
|
195 |
|
196 |
+
accordion = gr.Accordion(label="Add your keys (Click to expand)", open=False)
|
197 |
+
|
198 |
+
openai_key_tb = gr.Textbox(
|
199 |
+
visible=True,
|
200 |
+
label="OpenAI API Key",
|
201 |
+
placeholder="Enter your OpenAI API Key here (e.g., sk-...)",
|
202 |
+
type="password",
|
203 |
+
)
|
204 |
+
|
205 |
+
cohere_key_tb = gr.Textbox(
|
206 |
+
visible=True,
|
207 |
+
label="Cohere API Key",
|
208 |
+
placeholder="Enter your Cohere API Key here",
|
209 |
+
type="password",
|
210 |
+
)
|
211 |
+
|
212 |
|
213 |
with gr.Blocks(
|
214 |
fill_height=True,
|
215 |
title="AI Azure Architect 🤖",
|
216 |
analytics_enabled=True,
|
217 |
+
) as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
|
219 |
def onOpenAIKeyChange(x):
|
220 |
# Validate the OpenAI API Key format
|
|
|
230 |
logging.info(f"OpenAI API Key set: {x is not None}")
|
231 |
|
232 |
openai_key_tb.change(
|
233 |
+
onOpenAIKeyChange,
|
234 |
inputs=openai_key_tb,
|
235 |
outputs=None,
|
236 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
|
238 |
def onCohereKeyChange(x):
|
239 |
# Validate the Cohere API Key format
|
|
|
262 |
)
|
263 |
|
264 |
gr.ChatInterface(
|
265 |
+
fn=generate_completion,
|
266 |
chatbot=chatbot,
|
267 |
additional_inputs=[memory_state, openai_key_tb, cohere_key_tb],
|
268 |
+
additional_inputs_accordion=accordion,
|
269 |
)
|
270 |
|
271 |
demo.queue(default_concurrency_limit=64)
|
scripts/00_DataCollection.md
CHANGED
@@ -40,5 +40,7 @@ The vector is saved as a PKL file and uploaded to HF.
|
|
40 |
7. [Reranking](07_Reranking.ipynb)<br />
|
41 |
<em>Evaluate Cohere Rerank</em><br />
|
42 |
A jupiter notebook with steps to download the VectorDB, the embedding model and the evaluation dataset.
|
43 |
-
Then it evaluates the result with and without cohere. Setting the path for the final solution
|
|
|
44 |
|
|
|
|
40 |
7. [Reranking](07_Reranking.ipynb)<br />
|
41 |
<em>Evaluate Cohere Rerank</em><br />
|
42 |
A jupiter notebook with steps to download the VectorDB, the embedding model and the evaluation dataset.
|
43 |
+
Then it evaluates the result with and without cohere. Setting the path for the final solution<br />
|
44 |
+
<br />
|
45 |
|
46 |
+

|