Lhumpal commited on
Commit
4ea9a07
·
verified ·
1 Parent(s): 364a1fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -11,17 +11,14 @@ app = FastAPI()
11
  hf_token = os.environ.get("HF_TOKEN")
12
  # login(token=hf_token)
13
 
14
- # client = InferenceClient("HuggingFaceH4/zephyr-7b-beta", token=hf_token)
15
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta", token=hf_token)
16
  # dataset = load_dataset("Lhumpal/youtube-hunting-beast-transcripts", data_files={"concise": "concise/*", "raw": "raw/*"})
17
- dataset = None
18
-
19
- if dataset:
20
- texts = []
21
- for file in dataset["concise"]:
22
- # Remove newline characters from the 'text' field
23
- cleaned_text = file['text'].replace('\n', ' ')
24
- texts.append(cleaned_text)
25
 
26
  class ChatRequest(BaseModel):
27
  message: str
@@ -56,7 +53,7 @@ async def chat(request: ChatRequest):
56
  token = message.choices[0].delta.content
57
  response += token
58
 
59
- return {"assistant_response": response, "dataset_sample": "sample"}
60
 
61
  except Exception as e:
62
  raise HTTPException(status_code=500, detail=str(e))
 
11
  hf_token = os.environ.get("HF_TOKEN")
12
  # login(token=hf_token)
13
 
 
14
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta", token=hf_token)
15
  # dataset = load_dataset("Lhumpal/youtube-hunting-beast-transcripts", data_files={"concise": "concise/*", "raw": "raw/*"})
16
+ # if dataset:
17
+ # texts = []
18
+ # for file in dataset["concise"]:
19
+ # # Remove newline characters from the 'text' field
20
+ # cleaned_text = file['text'].replace('\n', ' ')
21
+ # texts.append(cleaned_text)
 
 
22
 
23
  class ChatRequest(BaseModel):
24
  message: str
 
53
  token = message.choices[0].delta.content
54
  response += token
55
 
56
+ return {"assistant_response": response}
57
 
58
  except Exception as e:
59
  raise HTTPException(status_code=500, detail=str(e))