Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,17 @@
|
|
|
|
1 |
from flask import Flask, request, jsonify
|
2 |
from transformers import pipeline
|
3 |
from langdetect import detect
|
|
|
4 |
|
5 |
app = Flask(__name__)
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
# Load models
|
8 |
hebrew_model = pipeline("text-generation", model="onlplab/alephbert-base")
|
9 |
english_model = pipeline("text-generation", model="mistralai/Mistral-7B-Instruct-v0.3")
|
|
|
1 |
+
import os
|
2 |
from flask import Flask, request, jsonify
|
3 |
from transformers import pipeline
|
4 |
from langdetect import detect
|
5 |
+
from huggingface_hub import login
|
6 |
|
7 |
app = Flask(__name__)
|
8 |
|
9 |
+
# Gets the Token from secrect
|
10 |
+
hf_hub_token = os.getenv("HUGGINGFACEHUB_API_TOKEN")
|
11 |
+
|
12 |
+
# Logging in
|
13 |
+
login(token=hf_hub_token)
|
14 |
+
|
15 |
# Load models
|
16 |
hebrew_model = pipeline("text-generation", model="onlplab/alephbert-base")
|
17 |
english_model = pipeline("text-generation", model="mistralai/Mistral-7B-Instruct-v0.3")
|