Shreyas094 commited on
Commit
78d4f2c
·
verified ·
1 Parent(s): 97c6d6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -78,7 +78,7 @@ def update_vectors(files, parser):
78
 
79
  return f"Vector store updated successfully. Processed {total_chunks} chunks from {len(files)} files using {parser}."
80
 
81
- def generate_chunked_response(prompt, model, max_tokens=1000, max_chunks=5, temperature=0.7):
82
  client = InferenceClient(
83
  model,
84
  token=huggingface_token,
@@ -119,7 +119,7 @@ class CitingSources(BaseModel):
119
  description="List of sources to cite. Should be an URL of the source."
120
  )
121
 
122
- def get_response_from_pdf(query, model, temperature=0.7):
123
  embed = get_embeddings()
124
  if os.path.exists("faiss_database"):
125
  database = FAISS.load_local("faiss_database", embed, allow_dangerous_deserialization=True)
@@ -143,7 +143,7 @@ Do not include a list of sources in your response. [/INST]"""
143
 
144
  return clean_text
145
 
146
- def get_response_with_search(query, model, temperature=0.7):
147
  search_results = duckduckgo_search(query)
148
  context = "\n".join(f"{result['title']}\n{result['body']}\nSource: {result['href']}\n"
149
  for result in search_results if 'body' in result)
@@ -220,8 +220,8 @@ with gr.Blocks() as demo:
220
  use_web_search = gr.Checkbox(label="Use Web Search", value=False)
221
 
222
  with gr.Row():
223
- model_dropdown = gr.Dropdown(choices=MODELS, label="Select Model", value=MODELS[2])
224
- temperature_slider = gr.Slider(minimum=0.1, maximum=1.0, value=0.7, step=0.1, label="Temperature")
225
 
226
  submit = gr.Button("Submit")
227
 
 
78
 
79
  return f"Vector store updated successfully. Processed {total_chunks} chunks from {len(files)} files using {parser}."
80
 
81
+ def generate_chunked_response(prompt, model, max_tokens=1000, max_chunks=5, temperature=0.2):
82
  client = InferenceClient(
83
  model,
84
  token=huggingface_token,
 
119
  description="List of sources to cite. Should be an URL of the source."
120
  )
121
 
122
+ def get_response_from_pdf(query, model, temperature=0.2):
123
  embed = get_embeddings()
124
  if os.path.exists("faiss_database"):
125
  database = FAISS.load_local("faiss_database", embed, allow_dangerous_deserialization=True)
 
143
 
144
  return clean_text
145
 
146
+ def get_response_with_search(query, model, temperature=0.2):
147
  search_results = duckduckgo_search(query)
148
  context = "\n".join(f"{result['title']}\n{result['body']}\nSource: {result['href']}\n"
149
  for result in search_results if 'body' in result)
 
220
  use_web_search = gr.Checkbox(label="Use Web Search", value=False)
221
 
222
  with gr.Row():
223
+ model_dropdown = gr.Dropdown(choices=MODELS, label="Select Model", value=MODELS[1])
224
+ temperature_slider = gr.Slider(minimum=0.1, maximum=1.0, value=0.2, step=0.1, label="Temperature")
225
 
226
  submit = gr.Button("Submit")
227