File size: 738 Bytes
5b167c5
fcfc065
 
9531470
 
eb8d2bd
 
b3bea6e
 
 
 
1a209c5
b3bea6e
 
 
 
2239686
0bac597
2239686
 
0bac597
2239686
 
b3bea6e
 
5d76d29
41f6e0a
 
a1867ae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import streamlit as st
import pandas as pd
import numpy as np
import cv2
st.write(cv2.__version__)
print(cv2.__version__)


import json
import requests
API_URL = "https://api-inference.huggingface.co/models/gpt2"
headers = {"Authorization": f"Bearer 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"}
def query(payload):
    data = json.dumps(payload)
    response = requests.request("POST", API_URL, headers=headers, data=data)
    return json.loads(response.content.decode("utf-8"))
inp = st.text_input("Query")
t = st.slider('Temperature', 1, 200, 2)
q = {
    "inputs":inp,
    "parameters":{"temperature":float(t)*0.5}
}
data = query(q)
print(data)

st.write(data[0]['generated_text'])
a = np.ones((100,100,3),np.uint8)
a[:,:,0]=255
st.video(a)