Spaces:
Runtime error
Runtime error
doncamilom
commited on
Commit
•
a6a859d
1
Parent(s):
d409b89
new version of CC including new synthesis tool
Browse files- app.py +21 -12
- requirements.txt +1 -1
app.py
CHANGED
@@ -61,13 +61,6 @@ def on_api_key_change():
|
|
61 |
if not oai_key_isvalid(api_key):
|
62 |
st.write("Please input a valid OpenAI API key.")
|
63 |
|
64 |
-
pre_prompts = [
|
65 |
-
'What is the molecular weight of sugar',
|
66 |
-
'Can I safely mix caffeine and sodium hydroxide?',
|
67 |
-
'How is safinamide synthesized?',
|
68 |
-
'How similar is morphine to heroin?'
|
69 |
-
]
|
70 |
-
|
71 |
|
72 |
def run_prompt(prompt):
|
73 |
st.chat_message("user").write(prompt)
|
@@ -86,6 +79,23 @@ def run_prompt(prompt):
|
|
86 |
st.write("Please input a valid OpenAI API key")
|
87 |
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
# sidebar
|
90 |
with st.sidebar:
|
91 |
chemcrow_logo = Image.open('assets/chemcrow-logo-bold-new.png')
|
@@ -106,24 +116,23 @@ with st.sidebar:
|
|
106 |
cols = st.columns(2)
|
107 |
with cols[0]:
|
108 |
st.button(
|
109 |
-
|
110 |
on_click=lambda: run_prompt(pre_prompts[0]),
|
111 |
)
|
112 |
st.button(
|
113 |
-
|
114 |
on_click=lambda: run_prompt(pre_prompts[1]),
|
115 |
)
|
116 |
with cols[1]:
|
117 |
st.button(
|
118 |
-
|
119 |
on_click=lambda: run_prompt(pre_prompts[2]),
|
120 |
)
|
121 |
st.button(
|
122 |
-
|
123 |
on_click=lambda: run_prompt(pre_prompts[3]),
|
124 |
)
|
125 |
|
126 |
-
|
127 |
# Display available tools
|
128 |
st.markdown(f"# {len(tool_list)} available tools")
|
129 |
st.dataframe(
|
|
|
61 |
if not oai_key_isvalid(api_key):
|
62 |
st.write("Please input a valid OpenAI API key.")
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
def run_prompt(prompt):
|
66 |
st.chat_message("user").write(prompt)
|
|
|
79 |
st.write("Please input a valid OpenAI API key")
|
80 |
|
81 |
|
82 |
+
pre_prompts = [
|
83 |
+
'How can I synthesize safinamide?',
|
84 |
+
(
|
85 |
+
'Predict the product of a mixture of Ethylidenecyclohexane and HBr. Then '
|
86 |
+
'predict the same reaction, adding methyl peroxide into the mixture. '
|
87 |
+
'Compare the two products and explain the reaction mechanism.'
|
88 |
+
),
|
89 |
+
(
|
90 |
+
'What is the boiling point of the reaction product between '
|
91 |
+
'isoamyl alcohol and acetic acid?'
|
92 |
+
),
|
93 |
+
(
|
94 |
+
'Find 3 alkaloids in the cannabis plant, '
|
95 |
+
'and calculate their similarity with caffein'
|
96 |
+
)
|
97 |
+
]
|
98 |
+
|
99 |
# sidebar
|
100 |
with st.sidebar:
|
101 |
chemcrow_logo = Image.open('assets/chemcrow-logo-bold-new.png')
|
|
|
116 |
cols = st.columns(2)
|
117 |
with cols[0]:
|
118 |
st.button(
|
119 |
+
"How can I synthesize safinamide?",
|
120 |
on_click=lambda: run_prompt(pre_prompts[0]),
|
121 |
)
|
122 |
st.button(
|
123 |
+
"Explain mechanism of bromoadition reaction",
|
124 |
on_click=lambda: run_prompt(pre_prompts[1]),
|
125 |
)
|
126 |
with cols[1]:
|
127 |
st.button(
|
128 |
+
'Predict properties of a reaction product',
|
129 |
on_click=lambda: run_prompt(pre_prompts[2]),
|
130 |
)
|
131 |
st.button(
|
132 |
+
'Similarities between alkaloids',
|
133 |
on_click=lambda: run_prompt(pre_prompts[3]),
|
134 |
)
|
135 |
|
|
|
136 |
# Display available tools
|
137 |
st.markdown(f"# {len(tool_list)} available tools")
|
138 |
st.dataframe(
|
requirements.txt
CHANGED
@@ -5,7 +5,7 @@ python-dotenv
|
|
5 |
duckduckgo-search
|
6 |
wikipedia
|
7 |
wandb
|
8 |
-
chemcrow==0.3.
|
9 |
pydantic==1.10.7
|
10 |
langchain==0.0.275
|
11 |
typing-inspect==0.8.0
|
|
|
5 |
duckduckgo-search
|
6 |
wikipedia
|
7 |
wandb
|
8 |
+
chemcrow==0.3.12
|
9 |
pydantic==1.10.7
|
10 |
langchain==0.0.275
|
11 |
typing-inspect==0.8.0
|