andreska commited on
Commit
c1c4977
·
verified ·
1 Parent(s): 2295d00

One more try for Inference, with imports

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -1,10 +1,12 @@
 
 
1
  import streamlit as st
2
 
3
  x = st.slider('Select a value')
4
  st.write(x, 'squared is', x * x)
5
 
6
  # Get the API key from the environment variable
7
- api_key = st.secrets("InferenceKey")
8
 
9
  # Initialize the Inference API with your model and API key
10
  api = InferenceApi(repo_id="gpt-3", token=api_key)
 
1
+ import os
2
+ from huggingface_hub import InferenceApi
3
  import streamlit as st
4
 
5
  x = st.slider('Select a value')
6
  st.write(x, 'squared is', x * x)
7
 
8
  # Get the API key from the environment variable
9
+ api_key = os.getenv("HF_API_KEY")
10
 
11
  # Initialize the Inference API with your model and API key
12
  api = InferenceApi(repo_id="gpt-3", token=api_key)