Spaces:
Running
Running
Update app
Browse files
app.py
CHANGED
|
@@ -3,6 +3,18 @@ import gradio as gr
|
|
| 3 |
from azure.ai.inference import ChatCompletionsClient
|
| 4 |
from azure.core.credentials import AzureKeyCredential
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
# Azure Inference setup
|
| 7 |
url = os.getenv("Azure_Endpoint")
|
| 8 |
api_key = AzureKeyCredential(os.getenv("Azure_API_KEY"))
|
|
|
|
| 3 |
from azure.ai.inference import ChatCompletionsClient
|
| 4 |
from azure.core.credentials import AzureKeyCredential
|
| 5 |
|
| 6 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
model_path = "microsoft/Phi-4-mini-instruct"
|
| 10 |
+
hf_model = AutoModelForCausalLM.from_pretrained(
|
| 11 |
+
model_path,
|
| 12 |
+
device_map="auto",
|
| 13 |
+
torch_dtype="auto",
|
| 14 |
+
trust_remote_code=True,
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
|
| 18 |
# Azure Inference setup
|
| 19 |
url = os.getenv("Azure_Endpoint")
|
| 20 |
api_key = AzureKeyCredential(os.getenv("Azure_API_KEY"))
|