bstraehle commited on
Commit
82fd045
·
verified ·
1 Parent(s): 99fc5fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -14
app.py CHANGED
@@ -1,20 +1,11 @@
1
  import gradio as gr
2
- #import pandas as pd
3
  import logging, os, sys, threading
4
 
5
- #from dotenv import load_dotenv, find_dotenv
6
  from custom_utils import connect_to_database, rag_ingestion, rag_retrieval, rag_inference
7
 
8
- #from pydantic import BaseModel
9
- #from typing import Optional
10
-
11
- #from IPython.display import display, HTML
12
-
13
  lock = threading.Lock()
14
 
15
- #_ = load_dotenv(find_dotenv())
16
-
17
- RAG_INGESTION = True
18
 
19
  RAG_OFF = "Off"
20
  RAG_NAIVE = "Naive RAG"
@@ -35,8 +26,7 @@ def invoke(openai_api_key, prompt, rag_option):
35
  db, collection = connect_to_database()
36
 
37
  if (RAG_INGESTION):
38
- rag_ingestion(collection)
39
- return "Done"
40
  else:
41
  """
42
  match_stage = {
@@ -50,8 +40,7 @@ def invoke(openai_api_key, prompt, rag_option):
50
  """
51
 
52
  search_results = rag_retrieval(openai_api_key, prompt, db, collection)
53
- result = rag_inference(openai_api_key, prompt, search_results)
54
- return result
55
 
56
  gr.close_all()
57
 
 
1
  import gradio as gr
 
2
  import logging, os, sys, threading
3
 
 
4
  from custom_utils import connect_to_database, rag_ingestion, rag_retrieval, rag_inference
5
 
 
 
 
 
 
6
  lock = threading.Lock()
7
 
8
+ RAG_INGESTION = False
 
 
9
 
10
  RAG_OFF = "Off"
11
  RAG_NAIVE = "Naive RAG"
 
26
  db, collection = connect_to_database()
27
 
28
  if (RAG_INGESTION):
29
+ return rag_ingestion(collection)
 
30
  else:
31
  """
32
  match_stage = {
 
40
  """
41
 
42
  search_results = rag_retrieval(openai_api_key, prompt, db, collection)
43
+ return rag_inference(openai_api_key, prompt, search_results)
 
44
 
45
  gr.close_all()
46