File size: 1,012 Bytes
fd5930b |
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 30 31 32 33 34 35 |
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "inclusionAI/Ring-mini-2.0"
print(f"load model {model_name}")
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto",
trust_remote_code=True
)
print(f"load tokenizer {model_name}")
tokenizer = AutoTokenizer.from_pretrained(model_name)
from flask import Flask
app = Flask(__name__)
print(f"Flask app")
# Главная страница
@app.route("/")
def home():
return f"<h1>Главная страница</h1><p>Добро пожаловать!</p><p>current model {model_name}</p>"
# Страница "О нас"
@app.route("/about")
def about():
return "<h1>О нас</h1><p>Мы изучаем Flask!</p>"
# Страница "Контакты"
@app.route("/contact")
def contact():
return "<h1>Контакты</h1><p>Свяжитесь с нами: email@example.com</p>"
if __name__ == "__main__":
app.run(debug=False, host='0.0.0.0', port=7860) |