Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,12 @@ token = os.getenv("HF_TOKEN", None)
|
|
| 7 |
headers = {"Authorization": f"Bearer {token}"}
|
| 8 |
API_URL = "https://api-inference.huggingface.co/models/facebook/bart-large-cnn"
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# Function to query the Hugging Face model
|
| 11 |
def query(payload):
|
| 12 |
response = requests.post(API_URL, headers=headers, json=payload)
|
|
@@ -14,12 +20,11 @@ def query(payload):
|
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
-
# Input textbox
|
| 18 |
user_input = st.text_input("You:", "")
|
| 19 |
|
| 20 |
|
| 21 |
-
|
| 22 |
-
# Submit button
|
| 23 |
if st.button("Send"):
|
| 24 |
if user_input.strip() != "":
|
| 25 |
# Query Hugging Face model
|
|
@@ -35,10 +40,9 @@ if st.button("Send"):
|
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
-
# Title and description
|
| 39 |
-
st.title("Large Language Model Chat API")
|
| 40 |
|
| 41 |
-
|
|
|
|
| 42 |
# Model selection
|
| 43 |
model = st.radio(
|
| 44 |
"Model",
|
|
@@ -56,6 +60,7 @@ model = st.radio(
|
|
| 56 |
# Input textbox
|
| 57 |
input_text = st.text_input(label="Type an input and press Enter", placeholder="What is Deep Learning?")
|
| 58 |
|
|
|
|
| 59 |
# Parameters
|
| 60 |
with st.expander("Parameters", expanded=False):
|
| 61 |
typical_p = st.slider("Typical P mass", min_value=0.0, max_value=1.0, value=0.2, step=0.05)
|
|
|
|
| 7 |
headers = {"Authorization": f"Bearer {token}"}
|
| 8 |
API_URL = "https://api-inference.huggingface.co/models/facebook/bart-large-cnn"
|
| 9 |
|
| 10 |
+
|
| 11 |
+
# Title and description for this particular project
|
| 12 |
+
st.title("Large Language Model using Inference API")
|
| 13 |
+
st.write("This project will show how Inference API and Bart LLM uses text summarization.")
|
| 14 |
+
st.write("It is very simple implementation, and other models can be used.")
|
| 15 |
+
|
| 16 |
# Function to query the Hugging Face model
|
| 17 |
def query(payload):
|
| 18 |
response = requests.post(API_URL, headers=headers, json=payload)
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
+
# Input textbox to introduce prompt
|
| 24 |
user_input = st.text_input("You:", "")
|
| 25 |
|
| 26 |
|
| 27 |
+
# Submit button to run the inference API
|
|
|
|
| 28 |
if st.button("Send"):
|
| 29 |
if user_input.strip() != "":
|
| 30 |
# Query Hugging Face model
|
|
|
|
| 40 |
|
| 41 |
|
| 42 |
|
|
|
|
|
|
|
| 43 |
|
| 44 |
+
|
| 45 |
+
|
| 46 |
# Model selection
|
| 47 |
model = st.radio(
|
| 48 |
"Model",
|
|
|
|
| 60 |
# Input textbox
|
| 61 |
input_text = st.text_input(label="Type an input and press Enter", placeholder="What is Deep Learning?")
|
| 62 |
|
| 63 |
+
'''
|
| 64 |
# Parameters
|
| 65 |
with st.expander("Parameters", expanded=False):
|
| 66 |
typical_p = st.slider("Typical P mass", min_value=0.0, max_value=1.0, value=0.2, step=0.05)
|