Spaces:
Sleeping
Sleeping
Added endpoint query
Browse files
app.py
CHANGED
@@ -1,7 +1,21 @@
|
|
1 |
import streamlit as st
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
def get_completion(prompt):
|
4 |
-
|
|
|
|
|
|
|
|
|
5 |
|
6 |
def main():
|
7 |
st.title('LLM Text Completion Interface')
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
+
API_URL = "https://g8u06j6fqi4vyi5i.eu-west-1.aws.endpoints.huggingface.cloud"
|
4 |
+
headers = {
|
5 |
+
"Accept" : "application/json",
|
6 |
+
"Content-Type": "application/json"
|
7 |
+
}
|
8 |
+
|
9 |
+
def query(payload):
|
10 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
11 |
+
return response.json()
|
12 |
+
|
13 |
def get_completion(prompt):
|
14 |
+
output = query({
|
15 |
+
"inputs": f"{prompt}",
|
16 |
+
"parameters": {}
|
17 |
+
})
|
18 |
+
return output[0]["generated_text"]
|
19 |
|
20 |
def main():
|
21 |
st.title('LLM Text Completion Interface')
|