Changing model and adding active wait
Browse files
app.py
CHANGED
@@ -4,13 +4,16 @@ import time
|
|
4 |
import requests
|
5 |
import streamlit as st
|
6 |
|
7 |
-
API_URL = "https://api-inference.huggingface.co/models/
|
8 |
|
9 |
|
10 |
def translate(text, wait=True):
|
11 |
headers = {"Authorization": f"Bearer {os.environ['BEARER']}"}
|
12 |
payload = {
|
13 |
"inputs": text,
|
|
|
|
|
|
|
14 |
}
|
15 |
response = requests.post(API_URL, headers=headers, json=payload)
|
16 |
json_response = response.json()
|
|
|
4 |
import requests
|
5 |
import streamlit as st
|
6 |
|
7 |
+
API_URL = "https://api-inference.huggingface.co/models/pere/nb-nn-translation"
|
8 |
|
9 |
|
10 |
def translate(text, wait=True):
|
11 |
headers = {"Authorization": f"Bearer {os.environ['BEARER']}"}
|
12 |
payload = {
|
13 |
"inputs": text,
|
14 |
+
"options": {
|
15 |
+
"wait_for_model": not wait
|
16 |
+
}
|
17 |
}
|
18 |
response = requests.post(API_URL, headers=headers, json=payload)
|
19 |
json_response = response.json()
|