htohfa commited on
Commit
fcb02e5
·
1 Parent(s): 2502a3c

changes for hugging face

Browse files
Files changed (1) hide show
  1. app.py +15 -7
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import sys
2
  import time
3
  from pathlib import Path
 
4
 
5
  sys.path.insert(0, str(Path(__file__).parent))
6
 
@@ -108,11 +109,17 @@ with col_left:
108
  model_label = st.selectbox("Model", options=MODEL_LABELS, label_visibility="collapsed")
109
 
110
  st.markdown('<p class="section-label" style="margin-top:1.2rem;">Anthropic API Key</p>', unsafe_allow_html=True)
111
- api_key = st.text_input("Anthropic API Key", type="password", label_visibility="collapsed", placeholder="sk-ant-...")
112
-
 
 
 
113
  st.markdown('<p class="section-label" style="margin-top:0.8rem;">Semantic Scholar Key (optional)</p>', unsafe_allow_html=True)
114
- s2_key = st.text_input("S2 Key", type="password", label_visibility="collapsed", placeholder="(Recommended for keyword fallback)")
115
-
 
 
 
116
  st.markdown('<p class="section-label" style="margin-top:1.5rem;">Describe the figure</p>', unsafe_allow_html=True)
117
  user_text = st.text_area(
118
  "Figure description", label_visibility="collapsed", height=120,
@@ -140,9 +147,10 @@ with col_left:
140
  if use_pathfinder:
141
  st.markdown('<p class="section-label" style="margin-top:0.6rem;">OpenAI API Key</p>', unsafe_allow_html=True)
142
  openai_key = st.text_input(
143
- "OpenAI Key", type="password", label_visibility="collapsed",
144
- placeholder="sk-...",
145
- )
 
146
  st.markdown(
147
  '<p style="font-size:0.78rem;color:#888;margin-top:-0.4rem;">'
148
  'Used to embed queries with text-embedding-3-small (~$0.40 per million queries).'
 
1
  import sys
2
  import time
3
  from pathlib import Path
4
+ import os
5
 
6
  sys.path.insert(0, str(Path(__file__).parent))
7
 
 
109
  model_label = st.selectbox("Model", options=MODEL_LABELS, label_visibility="collapsed")
110
 
111
  st.markdown('<p class="section-label" style="margin-top:1.2rem;">Anthropic API Key</p>', unsafe_allow_html=True)
112
+ api_key = st.text_input(
113
+ "Anthropic API Key", type="password", label_visibility="collapsed",
114
+ placeholder="sk-ant-...",
115
+ value=os.environ.get("ANTHROPIC_API_KEY", ""),
116
+ )
117
  st.markdown('<p class="section-label" style="margin-top:0.8rem;">Semantic Scholar Key (optional)</p>', unsafe_allow_html=True)
118
+ s2_key = st.text_input(
119
+ "S2 Key", type="password", label_visibility="collapsed",
120
+ placeholder="(Recommended for keyword fallback)",
121
+ value=os.environ.get("S2_API_KEY", ""),
122
+ )
123
  st.markdown('<p class="section-label" style="margin-top:1.5rem;">Describe the figure</p>', unsafe_allow_html=True)
124
  user_text = st.text_area(
125
  "Figure description", label_visibility="collapsed", height=120,
 
147
  if use_pathfinder:
148
  st.markdown('<p class="section-label" style="margin-top:0.6rem;">OpenAI API Key</p>', unsafe_allow_html=True)
149
  openai_key = st.text_input(
150
+ "OpenAI Key", type="password", label_visibility="collapsed",
151
+ placeholder="sk-...",
152
+ value=os.environ.get("OPENAI_API_KEY", ""),
153
+ )
154
  st.markdown(
155
  '<p style="font-size:0.78rem;color:#888;margin-top:-0.4rem;">'
156
  'Used to embed queries with text-embedding-3-small (~$0.40 per million queries).'