Mark000111888 commited on
Commit
09024ef
1 Parent(s): d958afc

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +41 -0
  2. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import json
3
+ import requests
4
+ import io
5
+
6
+ ### Inputs
7
+ x = st.text_input('Add your prompt here')
8
+
9
+ ###Load variables
10
+ model_location = 'Mobius-labs/JenL_demo'
11
+
12
+
13
+ ### API Request
14
+ #API_TOKEN = st.secrets["API_TOKEN"]
15
+ API_TOKEN = "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"
16
+
17
+ API_URL = "https://api-inference.huggingface.co/models/" + model_location
18
+
19
+ headers = {"Authorization": f"Bearer {API_TOKEN}"}
20
+
21
+ def query(payload):
22
+ data = json.dumps(payload)
23
+ response = requests.request("POST", API_URL, headers=headers, data=data)
24
+
25
+ return io.BytesIO(response.content)
26
+
27
+
28
+
29
+ ### Button
30
+ def process_api_output():
31
+ data = query(x)
32
+
33
+ st.image(data, output_format="JPEG")
34
+
35
+ b = st.button('Submit prompt')
36
+
37
+ if b:
38
+ process_api_output()
39
+
40
+ #st.write(x, 'model_name is', model_name)
41
+ #st.write(x, 'model_location is', model_location)
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ transformers
2
+ streamlit
3
+ torch