lmastm commited on
Commit
dac79e1
·
verified ·
1 Parent(s): 8f5ceee

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
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)