Mina Parham commited on
Commit ·
09f366d
1
Parent(s): ff48a14
hf api token
Browse files
app.py
CHANGED
|
@@ -2,6 +2,11 @@ import gradio as gr
|
|
| 2 |
import requests
|
| 3 |
import asyncio
|
| 4 |
import aiohttp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
# Models setup
|
| 7 |
models = {
|
|
@@ -14,7 +19,7 @@ models = {
|
|
| 14 |
judge_model_url = "https://api-inference.huggingface.co/models/mistralai/Mixtral-8x7B-Instruct-v0.1"
|
| 15 |
|
| 16 |
# Your Hugging Face API Token
|
| 17 |
-
API_TOKEN =
|
| 18 |
HEADERS = {"Authorization": f"Bearer {API_TOKEN}"}
|
| 19 |
|
| 20 |
# Async function to call a model
|
|
|
|
| 2 |
import requests
|
| 3 |
import asyncio
|
| 4 |
import aiohttp
|
| 5 |
+
import os
|
| 6 |
+
|
| 7 |
+
HF_API_TOKEN = os.getenv("HF_API_TOKEN")
|
| 8 |
+
|
| 9 |
+
|
| 10 |
|
| 11 |
# Models setup
|
| 12 |
models = {
|
|
|
|
| 19 |
judge_model_url = "https://api-inference.huggingface.co/models/mistralai/Mixtral-8x7B-Instruct-v0.1"
|
| 20 |
|
| 21 |
# Your Hugging Face API Token
|
| 22 |
+
API_TOKEN = HF_API_TOKEN
|
| 23 |
HEADERS = {"Authorization": f"Bearer {API_TOKEN}"}
|
| 24 |
|
| 25 |
# Async function to call a model
|