asoria HF staff commited on
Commit
a9c2212
1 Parent(s): 63844ef

Import Token

Browse files
Files changed (2) hide show
  1. app.py +10 -7
  2. requirements.txt +2 -1
app.py CHANGED
@@ -1,18 +1,15 @@
1
  import requests
2
  import logging
3
  import duckdb
 
 
4
  from gradio_huggingfacehub_search import HuggingfaceHubSearch
5
  from bertopic import BERTopic
6
  from bertopic.representation import (
7
  KeyBERTInspired,
8
  TextGeneration,
9
  )
10
- from bitsandbytes.cuda_setup.main import CUDASetup
11
-
12
- setup = CUDASetup.get_instance()
13
-
14
  from umap import UMAP
15
- import numpy as np
16
  from torch import cuda, bfloat16
17
  from transformers import (
18
  BitsAndBytesConfig,
@@ -24,13 +21,19 @@ from prompts import REPRESENTATION_PROMPT
24
  from hdbscan import HDBSCAN
25
  from sklearn.feature_extraction.text import CountVectorizer
26
 
27
- # from cuml.cluster import HDBSCAN
28
- # from cuml.manifold import UMAP
29
  from sentence_transformers import SentenceTransformer
30
 
 
 
 
31
  import spaces
32
  import gradio as gr
33
 
 
 
 
 
 
34
  logging.basicConfig(
35
  level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
36
  )
 
1
  import requests
2
  import logging
3
  import duckdb
4
+ import numpy as np
5
+
6
  from gradio_huggingfacehub_search import HuggingfaceHubSearch
7
  from bertopic import BERTopic
8
  from bertopic.representation import (
9
  KeyBERTInspired,
10
  TextGeneration,
11
  )
 
 
 
 
12
  from umap import UMAP
 
13
  from torch import cuda, bfloat16
14
  from transformers import (
15
  BitsAndBytesConfig,
 
21
  from hdbscan import HDBSCAN
22
  from sklearn.feature_extraction.text import CountVectorizer
23
 
 
 
24
  from sentence_transformers import SentenceTransformer
25
 
26
+ from dotenv import load_dotenv
27
+ import os
28
+
29
  import spaces
30
  import gradio as gr
31
 
32
+
33
+ load_dotenv()
34
+ HF_TOKEN = os.getenv("HF_TOKEN")
35
+ assert HF_TOKEN is not None, "You need to set HF_TOKEN in your environment variables"
36
+
37
  logging.basicConfig(
38
  level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
39
  )
requirements.txt CHANGED
@@ -5,8 +5,9 @@ duckdb
5
  umap-learn
6
  sentence-transformers
7
  bitsandbytes
8
- datamapplot
9
  bertopic
10
  pandas
11
  torch
12
  numpy
 
 
5
  umap-learn
6
  sentence-transformers
7
  bitsandbytes
8
+ datamapplot==0.3.0
9
  bertopic
10
  pandas
11
  torch
12
  numpy
13
+ python-dotenv