MHULO commited on
Commit
bdf5cae
·
verified ·
1 Parent(s): 33a3ad0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -5
app.py CHANGED
@@ -1,12 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  from fastapi import FastAPI
2
  from pydantic import BaseModel
3
  from transformers import pipeline
4
  import os
5
- from huggingface_hub import login
6
-
7
- # Log in to Hugging Face
8
- access_token = os.environ.get("ACCESS_TOKEN_1")
9
- login(token=access_token, add_to_git_credential=True)
10
 
11
  app = FastAPI()
12
 
@@ -25,3 +49,4 @@ def predict(request: TextRequest):
25
  if __name__ == "__main__":
26
  import uvicorn
27
  uvicorn.run(app, host="0.0.0.0", port=80)
 
 
1
+ # from fastapi import FastAPI
2
+ # from pydantic import BaseModel
3
+ # from transformers import pipeline
4
+ # import os
5
+ # from huggingface_hub import login
6
+
7
+ # # Log in to Hugging Face
8
+ # access_token = os.environ.get("ACCESS_TOKEN_1")
9
+ # login(token=access_token, add_to_git_credential=True)
10
+
11
+ # app = FastAPI()
12
+
13
+ # # Load the model and tokenizer from the Hugging Face Hub
14
+ # model_name = "MHULO/yembaner"
15
+ # nlp = pipeline("ner", model=model_name, tokenizer=model_name)
16
+
17
+ # class TextRequest(BaseModel):
18
+ # text: str
19
+
20
+ # @app.post("/predict/")
21
+ # def predict(request: TextRequest):
22
+ # ner_results = nlp(request.text)
23
+ # return ner_results
24
+
25
+ # if __name__ == "__main__":
26
+ # import uvicorn
27
+ # uvicorn.run(app, host="0.0.0.0", port=80)
28
+
29
+
30
  from fastapi import FastAPI
31
  from pydantic import BaseModel
32
  from transformers import pipeline
33
  import os
 
 
 
 
 
34
 
35
  app = FastAPI()
36
 
 
49
  if __name__ == "__main__":
50
  import uvicorn
51
  uvicorn.run(app, host="0.0.0.0", port=80)
52
+