vncgabriel commited on
Commit
12c83d8
verified
1 Parent(s): a18ad17

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+ from huggingface_hub import snapshot_download
4
+ from chromadb import Client
5
+
6
+ # 1. Faz o download (ou usa cache) do seu repo de modelo/DB
7
+ repo_local = snapshot_download(
8
+ repo_id="vncgabriel/RioRAG",
9
+ repo_type="model"
10
+ )
11
+
12
+ # 2. Aponte o Chroma para a pasta que voc锚 subiu
13
+ chroma_dir = os.path.join(repo_local, "chroma_db")
14
+ client = Client(persist_directory=chroma_dir)
15
+
16
+ def query_rag(question):
17
+ # aqui sua l贸gica: buscar no client, chamar LLM, etc.
18
+ return "Resposta dummy para: " + question
19
+
20
+ iface = gr.Interface(
21
+ fn=query_rag,
22
+ inputs=gr.Textbox(lines=2, placeholder="Tell me what you want to know about Rio de Janeiro..."),
23
+ outputs="text",
24
+ title="RioRAG Demo"
25
+ )
26
+
27
+ if __name__ == "__main__":
28
+ iface.launch()