Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +23 -0
- requirements.txt +2 -0
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
x = st.slider('Select a value')
|
| 5 |
+
|
| 6 |
+
import requests
|
| 7 |
+
|
| 8 |
+
# Replace with your actual API token
|
| 9 |
+
api_token = os.getenv('huggingface')
|
| 10 |
+
headers = {"Authorization": f"Bearer {api_token}"}
|
| 11 |
+
|
| 12 |
+
# Replace 'gpt-3' with the model you want to use
|
| 13 |
+
api_url = "https://api-inference.huggingface.co/models/prometheus-eval/prometheus-7b-v2.0"
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def query(payload):
|
| 17 |
+
response = requests.post(api_url, headers=headers, json=payload)
|
| 18 |
+
return response.json()
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
# Example usage
|
| 22 |
+
data = query({"inputs": "Once upon a time"})
|
| 23 |
+
st.write(data)
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
requests~=2.31.0
|
| 2 |
+
streamlit
|