Update app.py
Browse files
app.py
CHANGED
@@ -1,26 +1,3 @@
|
|
1 |
-
# from fastapi import FastAPI
|
2 |
-
# from fastapi.responses import JSONResponse
|
3 |
-
# from fastapi import Request
|
4 |
-
# from huggingface_hub import InferenceClient
|
5 |
-
|
6 |
-
# app = FastAPI()
|
7 |
-
|
8 |
-
# @app.post("/")
|
9 |
-
# async def greet_json(request: Request):
|
10 |
-
# input_data = await request.json()
|
11 |
-
# # number = input_data.get("number")
|
12 |
-
|
13 |
-
# # tripled_number = number * 2
|
14 |
-
# # return {"message": f"Your input number is: {number}, your doubled number is: {tripled_number}"}
|
15 |
-
# user_input = input_data.get("user_input")
|
16 |
-
|
17 |
-
# client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
18 |
-
# # Get the response from the model
|
19 |
-
# response = client(user_input)
|
20 |
-
|
21 |
-
# # assistant_response = client.text_generation(user_input)
|
22 |
-
# assistant_response = "I am assistant."
|
23 |
-
# return {"assistant_message": f"Your input message is: {user_input}, assistant_response is: {response}"}
|
24 |
from fastapi import FastAPI, HTTPException
|
25 |
from pydantic import BaseModel
|
26 |
from huggingface_hub import InferenceClient
|
@@ -32,7 +9,6 @@ app = FastAPI()
|
|
32 |
|
33 |
# Get the token from the environment variable
|
34 |
hf_token = os.environ.get("HF_TOKEN")
|
35 |
-
login(hf_token)
|
36 |
|
37 |
# client = InferenceClient("HuggingFaceH4/zephyr-7b-beta", token=hf_token)
|
38 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta", token=hf_token)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from fastapi import FastAPI, HTTPException
|
2 |
from pydantic import BaseModel
|
3 |
from huggingface_hub import InferenceClient
|
|
|
9 |
|
10 |
# Get the token from the environment variable
|
11 |
hf_token = os.environ.get("HF_TOKEN")
|
|
|
12 |
|
13 |
# client = InferenceClient("HuggingFaceH4/zephyr-7b-beta", token=hf_token)
|
14 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta", token=hf_token)
|