Spaces:
Runtime error
Runtime error
found a way to add hf inputs to the vector store
Browse files- app.py +20 -1
- chain_weaviate.py +1 -1
app.py
CHANGED
@@ -10,6 +10,8 @@ from structured_experiment_chain import (
|
|
10 |
wikipedia_chain as experiment_wikipedia_chain
|
11 |
)
|
12 |
|
|
|
|
|
13 |
apparatus_retriever_options = {
|
14 |
"Arxiv": apparatus_arxiv_chain,
|
15 |
"PubMed": apparatus_pub_med_chain,
|
@@ -29,7 +31,24 @@ def generate_apparatus(input_text, retriever_choice):
|
|
29 |
|
30 |
def generate_experiment(input_text, retriever_choice):
|
31 |
selected_chain = experiment_retriever_options[retriever_choice]
|
32 |
-
output_text = selected_chain.invoke(input_text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
return output_text
|
34 |
|
35 |
generate_apparatus_interface = gr.Interface(
|
|
|
10 |
wikipedia_chain as experiment_wikipedia_chain
|
11 |
)
|
12 |
|
13 |
+
from weaviate_utils import init_client
|
14 |
+
|
15 |
apparatus_retriever_options = {
|
16 |
"Arxiv": apparatus_arxiv_chain,
|
17 |
"PubMed": apparatus_pub_med_chain,
|
|
|
31 |
|
32 |
def generate_experiment(input_text, retriever_choice):
|
33 |
selected_chain = experiment_retriever_options[retriever_choice]
|
34 |
+
exp_data = output_text = selected_chain.invoke(input_text)
|
35 |
+
|
36 |
+
weaviate_client = init_client()
|
37 |
+
|
38 |
+
science_experiment_collection = weaviate_client.collections.get("ScienceEperiment")
|
39 |
+
|
40 |
+
exp_uuid = science_experiment_collection.data.insert({
|
41 |
+
# "DateCreated": datetime.now(timezone.utc),
|
42 |
+
"FieldsOfStudy": exp_data['Fields_of_study'],
|
43 |
+
"Tags": exp_data['Fields_of_study'],
|
44 |
+
"Experiment_Name": exp_data['Experiment_Name'],
|
45 |
+
"Material": exp_data['Material'],
|
46 |
+
"Sources": exp_data['Sources'],
|
47 |
+
"Protocal": exp_data['Protocal'],
|
48 |
+
"Purpose_of_Experiments": exp_data['Purpose_of_Experiments'],
|
49 |
+
"Safety_Precaution": exp_data['Safety_Precuation'], # Corrected spelling mistake
|
50 |
+
"Level_of_Difficulty": exp_data['Level_of_Difficulty'],
|
51 |
+
})
|
52 |
return output_text
|
53 |
|
54 |
generate_apparatus_interface = gr.Interface(
|
chain_weaviate.py
CHANGED
@@ -33,7 +33,7 @@ def main():
|
|
33 |
|
34 |
|
35 |
exp_uuid = science_experiment_collection.data.insert({
|
36 |
-
"DateCreated": datetime.now(timezone.utc),
|
37 |
"FieldsOfStudy": exp_data['Fields_of_study'],
|
38 |
"Tags": exp_data['Fields_of_study'],
|
39 |
"Experiment_Name": exp_data['Experiment_Name'],
|
|
|
33 |
|
34 |
|
35 |
exp_uuid = science_experiment_collection.data.insert({
|
36 |
+
# "DateCreated": datetime.now(timezone.utc),
|
37 |
"FieldsOfStudy": exp_data['Fields_of_study'],
|
38 |
"Tags": exp_data['Fields_of_study'],
|
39 |
"Experiment_Name": exp_data['Experiment_Name'],
|