vjain commited on
Commit
c156bc5
1 Parent(s): 81591b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -21,17 +21,17 @@ def generate_embeddings(texts, model_id, hf_token):
21
  response = requests.post(api_url, headers=headers, json={"inputs": texts, "options":{"wait_for_model":True}})
22
  embeddings = response.json()
23
  return embeddings
24
- Bio_embeddings = load_dataset('vjain/biology_AP_embeddings')
25
  df1 = pd.DataFrame(Bio_embeddings['train'])
26
  df1["similarity"] = 0
27
 
28
- Physics_embeddings = load_dataset('vjain/AP_physics_embeddings')
29
  df2 = pd.DataFrame(Physics_embeddings['train'])
30
  df2["similarity"] = 0
31
 
32
  dataframes = {
33
- "Bio_embeddings": df1,
34
- "Physics_embeddings": df2
35
  }
36
  #df = pd.read_csv("TA_embeddings.csv")
37
  #df["embedding"]=df["embedding"].apply(eval).apply(np.array)
@@ -72,7 +72,7 @@ input_text = gr.inputs.Textbox(label="Enter your questions here", placeholder="E
72
  text_output = gr.outputs.Textbox(label="Answer")
73
  csv_dropdown = gr.inputs.Dropdown(
74
  label="Select the Book",
75
- choices=["Bio_embeddings", "Physics_embeddings"]
76
  )
77
  description = "Scholar Bot is a question answering system designed to provide accurate and relevant answers to questions from this book hosted by OpenStax https://openstax.org/details/books/biology-ap-courses. Simply enter your question in the text box above and Scholar Bot will use advanced natural language processing algorithms to search a large corpus of biology text to find the best answer for you. Scholar Bot uses the Sentence Transformers model to generate embeddings of text, and OpenAI's GPT-3 language model to provide answers to your questions."
78
 
 
21
  response = requests.post(api_url, headers=headers, json={"inputs": texts, "options":{"wait_for_model":True}})
22
  embeddings = response.json()
23
  return embeddings
24
+ AP_bio = load_dataset('vjain/biology_AP_embeddings')
25
  df1 = pd.DataFrame(Bio_embeddings['train'])
26
  df1["similarity"] = 0
27
 
28
+ AP_physics = load_dataset('vjain/AP_physics_embeddings')
29
  df2 = pd.DataFrame(Physics_embeddings['train'])
30
  df2["similarity"] = 0
31
 
32
  dataframes = {
33
+ "AP_Bio": df1,
34
+ "AP_Physics": df2
35
  }
36
  #df = pd.read_csv("TA_embeddings.csv")
37
  #df["embedding"]=df["embedding"].apply(eval).apply(np.array)
 
72
  text_output = gr.outputs.Textbox(label="Answer")
73
  csv_dropdown = gr.inputs.Dropdown(
74
  label="Select the Book",
75
+ choices=["AP_bio", "AP_Physics"]
76
  )
77
  description = "Scholar Bot is a question answering system designed to provide accurate and relevant answers to questions from this book hosted by OpenStax https://openstax.org/details/books/biology-ap-courses. Simply enter your question in the text box above and Scholar Bot will use advanced natural language processing algorithms to search a large corpus of biology text to find the best answer for you. Scholar Bot uses the Sentence Transformers model to generate embeddings of text, and OpenAI's GPT-3 language model to provide answers to your questions."
78