viskav commited on
Commit
873f1b1
·
verified ·
1 Parent(s): 81cbe90

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -1,14 +1,11 @@
1
- import os
2
  from fastapi import FastAPI
3
  from fastapi.middleware.cors import CORSMiddleware
4
  from pydantic import BaseModel
5
  from huggingface_hub import InferenceClient
6
 
7
- # Hosted model on Hugging Face (serverless inference)
8
  MODEL_ID = "microsoft/Phi-3-mini-4k-instruct"
9
-
10
- HF_TOKEN = os.getenv("HF_TOKEN", None) # optional if model is fully public
11
- client = InferenceClient(model=MODEL_ID, token=HF_TOKEN)
12
 
13
  app = FastAPI()
14
 
@@ -18,7 +15,7 @@ class HumanizeRequest(BaseModel):
18
  # CORS so your Vercel frontend can call this API
19
  app.add_middleware(
20
  CORSMiddleware,
21
- allow_origins=["*"], # later you can set ["https://formatai.live"]
22
  allow_credentials=True,
23
  allow_methods=["*"],
24
  allow_headers=["*"],
 
 
1
  from fastapi import FastAPI
2
  from fastapi.middleware.cors import CORSMiddleware
3
  from pydantic import BaseModel
4
  from huggingface_hub import InferenceClient
5
 
6
+ # Simple hosted model
7
  MODEL_ID = "microsoft/Phi-3-mini-4k-instruct"
8
+ client = InferenceClient(model=MODEL_ID)
 
 
9
 
10
  app = FastAPI()
11
 
 
15
  # CORS so your Vercel frontend can call this API
16
  app.add_middleware(
17
  CORSMiddleware,
18
+ allow_origins=["*"], # later: ["https://formatai.live"]
19
  allow_credentials=True,
20
  allow_methods=["*"],
21
  allow_headers=["*"],