Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,8 +4,8 @@ import os
|
|
| 4 |
import random
|
| 5 |
import time
|
| 6 |
|
| 7 |
-
os.system("pip install gradio, llama_index, ragatouille, llama-cpp-python")
|
| 8 |
-
os.system("git clone https://github.com/EnPaiva93/think-paraguayo-space-aux.git")
|
| 9 |
os.system("wget https://huggingface.co/thinkPy/gua-a_v0.2-dpo_mistral-7b_GGUF/resolve/main/gua-a_v0.2-dpo_mistral-7b_q4_K_M.gguf -O model.gguf")
|
| 10 |
|
| 11 |
from llama_cpp import Llama
|
|
@@ -46,16 +46,11 @@ llm = Llama(model_path="model.gguf",
|
|
| 46 |
n_ctx=512,
|
| 47 |
n_threads=2)
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
DOC_PATH = BASE_PATH+"index/"
|
| 52 |
|
| 53 |
print(os.listdir())
|
| 54 |
|
| 55 |
-
|
| 56 |
-
os.system("sudo cp -r ./think-paraguayo-space-aux/ /content/")
|
| 57 |
-
|
| 58 |
-
documents = SimpleDirectoryReader(input_files=[BASE_PATH+"libro.txt"]).load_data()
|
| 59 |
|
| 60 |
parser = SentenceSplitter(chunk_size=128, chunk_overlap=64)
|
| 61 |
nodes = parser.get_nodes_from_documents(
|
|
@@ -68,6 +63,7 @@ print(os.getcwd())
|
|
| 68 |
# if os.path.exists(DOC_PATH):
|
| 69 |
RAG = RAGPretrainedModel.from_pretrained("AdrienB134/ColBERTv2.0-spanish-mmarcoES")
|
| 70 |
RAG = RAG.from_index(DOC_PATH, n_gpu=None)
|
|
|
|
| 71 |
|
| 72 |
# else:
|
| 73 |
# RAG = RAGPretrainedModel.from_pretrained("AdrienB134/ColBERTv2.0-spanish-mmarcoES")
|
|
@@ -153,7 +149,7 @@ def launcher():
|
|
| 153 |
|
| 154 |
with gr.Row(variant='panel'):
|
| 155 |
with gr.Column(scale=1):
|
| 156 |
-
gr.Image(value=
|
| 157 |
|
| 158 |
with gr.Column(scale=1):
|
| 159 |
# with gr.Row():
|
|
|
|
| 4 |
import random
|
| 5 |
import time
|
| 6 |
|
| 7 |
+
# os.system("pip install gradio, llama_index, ragatouille, llama-cpp-python")
|
| 8 |
+
# os.system("git clone https://github.com/EnPaiva93/think-paraguayo-space-aux.git")
|
| 9 |
os.system("wget https://huggingface.co/thinkPy/gua-a_v0.2-dpo_mistral-7b_GGUF/resolve/main/gua-a_v0.2-dpo_mistral-7b_q4_K_M.gguf -O model.gguf")
|
| 10 |
|
| 11 |
from llama_cpp import Llama
|
|
|
|
| 46 |
n_ctx=512,
|
| 47 |
n_threads=2)
|
| 48 |
|
| 49 |
+
DOC_PATH = ".ragatouille/colbert/indexes/index"
|
|
|
|
|
|
|
| 50 |
|
| 51 |
print(os.listdir())
|
| 52 |
|
| 53 |
+
documents = SimpleDirectoryReader(input_files=["libro.txt"]).load_data()
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
parser = SentenceSplitter(chunk_size=128, chunk_overlap=64)
|
| 56 |
nodes = parser.get_nodes_from_documents(
|
|
|
|
| 63 |
# if os.path.exists(DOC_PATH):
|
| 64 |
RAG = RAGPretrainedModel.from_pretrained("AdrienB134/ColBERTv2.0-spanish-mmarcoES")
|
| 65 |
RAG = RAG.from_index(DOC_PATH, n_gpu=None)
|
| 66 |
+
RAG.search("init", None, k=1)
|
| 67 |
|
| 68 |
# else:
|
| 69 |
# RAG = RAGPretrainedModel.from_pretrained("AdrienB134/ColBERTv2.0-spanish-mmarcoES")
|
|
|
|
| 149 |
|
| 150 |
with gr.Row(variant='panel'):
|
| 151 |
with gr.Column(scale=1):
|
| 152 |
+
gr.Image(value="think_paraguayo.jpeg", type="filepath", label="Imagen Estática")
|
| 153 |
|
| 154 |
with gr.Column(scale=1):
|
| 155 |
# with gr.Row():
|