kaborg15 commited on
Commit
b11ec81
1 Parent(s): ebc0d7d

Added endpoint query

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -1,7 +1,21 @@
1
  import streamlit as st
2
 
 
 
 
 
 
 
 
 
 
 
3
  def get_completion(prompt):
4
- return prompt + " nonce"
 
 
 
 
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')