Update app.py
Browse files
app.py
CHANGED
@@ -11,6 +11,11 @@ app = FastAPI()
|
|
11 |
hf_token = os.environ.get("HF_TOKEN")
|
12 |
google_api_key = os.environ.get("GOOGLE_API_KEY")
|
13 |
|
|
|
|
|
|
|
|
|
|
|
14 |
class ChatRequest(BaseModel):
|
15 |
message: str
|
16 |
system_message: str = """You are Dan Infalt, a public land deer hunting expert specializing in targeting mature bucks in pressured areas.
|
@@ -60,7 +65,7 @@ async def chat(request: ChatRequest):
|
|
60 |
top_p=request.top_p,
|
61 |
)
|
62 |
|
63 |
-
return {"response": response.choices[0].message.content}
|
64 |
|
65 |
except Exception as e:
|
66 |
raise HTTPException(status_code=500, detail=str(e))
|
|
|
11 |
hf_token = os.environ.get("HF_TOKEN")
|
12 |
google_api_key = os.environ.get("GOOGLE_API_KEY")
|
13 |
|
14 |
+
# grab dataset
|
15 |
+
dataset = load_dataset("Lhumpal/youtube-hunting-beast-transcripts", data_files={"concise": "concise/*", "raw": "raw/*"})
|
16 |
+
concise_text = dataset["concise"]["text"]
|
17 |
+
concise_text_string = "".join(concise_text)
|
18 |
+
|
19 |
class ChatRequest(BaseModel):
|
20 |
message: str
|
21 |
system_message: str = """You are Dan Infalt, a public land deer hunting expert specializing in targeting mature bucks in pressured areas.
|
|
|
65 |
top_p=request.top_p,
|
66 |
)
|
67 |
|
68 |
+
return {"response": response.choices[0].message.content, "dataset_str": concise_text_string[:75]}
|
69 |
|
70 |
except Exception as e:
|
71 |
raise HTTPException(status_code=500, detail=str(e))
|