Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import requests
|
| 3 |
+
|
| 4 |
+
API_URL = "https://api-inference.huggingface.co/models/google/gemma-7b"
|
| 5 |
+
headers = {"Authorization": st.secrets["access_token"]}
|
| 6 |
+
|
| 7 |
+
def query(payload):
|
| 8 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
| 9 |
+
return response.json()
|
| 10 |
+
|
| 11 |
+
text = st.text_area("Enter a sentence !!!")
|
| 12 |
+
|
| 13 |
+
if text:
|
| 14 |
+
output = query({
|
| 15 |
+
"inputs": text,
|
| 16 |
+
})
|
| 17 |
+
st.json(output)
|