gloignon commited on
Commit
b5e03f3
·
verified ·
1 Parent(s): 4e90df8

bug fix translation

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -27,20 +27,20 @@ model = SentenceTransformer('paraphrase-multilingual-MiniLM-L12-v2')
27
  # Modify the Gradio interface to accept a list of identifiers and texts
28
  def compute_pca(data):
29
  # data is expected to be a list of dictionaries with 'Identifier' and 'Text' keys
30
- df = pd.DataFrame(data, columns=["Identifier", "Text"])
31
 
32
 
33
  # Remove rows where 'Identifier' or 'Text' is empty or contains only whitespace
34
  valid_entries = df[
35
- (df['Identifier'].str.strip() != '') &
36
- (df['Text'].str.strip() != '')
37
  ]
38
 
39
  if valid_entries.empty:
40
  return gr.Plot.update(value=None, label="Rien à analyser. Donnez moi du texte svp!")
41
 
42
  # Generate embeddings
43
- embeddings = model.encode(valid_entries['Text'].tolist())
44
 
45
  # Perform PCA to reduce to 2 dimensions
46
  pca = PCA(n_components=2)
@@ -97,4 +97,4 @@ def text_editor_app():
97
 
98
 
99
  # Launch the app
100
- text_editor_app().launch()
 
27
  # Modify the Gradio interface to accept a list of identifiers and texts
28
  def compute_pca(data):
29
  # data is expected to be a list of dictionaries with 'Identifier' and 'Text' keys
30
+ df = pd.DataFrame(data, columns=["Identifiant", "Texte"])
31
 
32
 
33
  # Remove rows where 'Identifier' or 'Text' is empty or contains only whitespace
34
  valid_entries = df[
35
+ (df['Identifiant'].str.strip() != '') &
36
+ (df['Texte'].str.strip() != '')
37
  ]
38
 
39
  if valid_entries.empty:
40
  return gr.Plot.update(value=None, label="Rien à analyser. Donnez moi du texte svp!")
41
 
42
  # Generate embeddings
43
+ embeddings = model.encode(valid_entries['Texte'].tolist())
44
 
45
  # Perform PCA to reduce to 2 dimensions
46
  pca = PCA(n_components=2)
 
97
 
98
 
99
  # Launch the app
100
+ text_editor_app().launch()