Spaces:
Sleeping
Sleeping
One more try for Inference, with imports
Browse files
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 =
|
| 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)
|