Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
|
| 2 |
import os
|
| 3 |
from huggingface_hub import login
|
| 4 |
from datasets import load_dataset
|
|
@@ -8,13 +8,11 @@ from huggingface_hub import hf_hub_download
|
|
| 8 |
import chromadb
|
| 9 |
from sentence_transformers import SentenceTransformer
|
| 10 |
|
| 11 |
-
import os
|
| 12 |
-
from huggingface_hub import login
|
| 13 |
|
| 14 |
# Charger le token depuis les secrets
|
| 15 |
hf_token = os.getenv("HF_TOKEN") # Assurez-vous que 'HF_TOKEN' est bien le nom du secret Hugging Face
|
| 16 |
|
| 17 |
-
#
|
| 18 |
login(hf_token)
|
| 19 |
# Charger le dataset
|
| 20 |
dataset = load_dataset("Maryem2025/dataset-train") # Changez le nom si nécessaire
|
|
@@ -55,8 +53,7 @@ class VectorStore:
|
|
| 55 |
texts = [
|
| 56 |
f"Name: {name}. Ingredients: {ingr}. Instructions: {instr}. Cuisine: {cui}. Total time: {total} minutes."
|
| 57 |
for name, ingr, instr, cui, total in zip(names, ingredients, instructions, cuisine, total_time)
|
| 58 |
-
|
| 59 |
-
#for name, ingr, instr in zip(names, ingredients, instructions)
|
| 60 |
]
|
| 61 |
|
| 62 |
# Ajouter les embeddings au store de vecteurs
|
|
@@ -111,12 +108,12 @@ demo = gr.Interface(
|
|
| 111 |
gr.Textbox(lines=2, placeholder="Enter your message here...", label="Message"),
|
| 112 |
],
|
| 113 |
outputs=gr.Textbox(label="Generated Text"),
|
| 114 |
-
title="
|
| 115 |
description="Running LLM with context retrieval from ChromaDB",
|
| 116 |
examples=[
|
| 117 |
["I have leftover rice, what can I make out of it?"],
|
| 118 |
["I just have some milk and chocolate, what dessert can I make?"],
|
| 119 |
-
|
| 120 |
["Can you suggest a vegan breakfast recipe?"],
|
| 121 |
["How do I make a perfect scrambled egg?"],
|
| 122 |
["Can you guide me through making a soufflé?"],
|
|
|
|
| 1 |
+
|
| 2 |
import os
|
| 3 |
from huggingface_hub import login
|
| 4 |
from datasets import load_dataset
|
|
|
|
| 8 |
import chromadb
|
| 9 |
from sentence_transformers import SentenceTransformer
|
| 10 |
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# Charger le token depuis les secrets
|
| 13 |
hf_token = os.getenv("HF_TOKEN") # Assurez-vous que 'HF_TOKEN' est bien le nom du secret Hugging Face
|
| 14 |
|
| 15 |
+
# Connecting à Hugging Face
|
| 16 |
login(hf_token)
|
| 17 |
# Charger le dataset
|
| 18 |
dataset = load_dataset("Maryem2025/dataset-train") # Changez le nom si nécessaire
|
|
|
|
| 53 |
texts = [
|
| 54 |
f"Name: {name}. Ingredients: {ingr}. Instructions: {instr}. Cuisine: {cui}. Total time: {total} minutes."
|
| 55 |
for name, ingr, instr, cui, total in zip(names, ingredients, instructions, cuisine, total_time)
|
| 56 |
+
|
|
|
|
| 57 |
]
|
| 58 |
|
| 59 |
# Ajouter les embeddings au store de vecteurs
|
|
|
|
| 108 |
gr.Textbox(lines=2, placeholder="Enter your message here...", label="Message"),
|
| 109 |
],
|
| 110 |
outputs=gr.Textbox(label="Generated Text"),
|
| 111 |
+
title="FALFOUL'S KITCHEN",
|
| 112 |
description="Running LLM with context retrieval from ChromaDB",
|
| 113 |
examples=[
|
| 114 |
["I have leftover rice, what can I make out of it?"],
|
| 115 |
["I just have some milk and chocolate, what dessert can I make?"],
|
| 116 |
+
|
| 117 |
["Can you suggest a vegan breakfast recipe?"],
|
| 118 |
["How do I make a perfect scrambled egg?"],
|
| 119 |
["Can you guide me through making a soufflé?"],
|