polinaeterna commited on
Commit
7badbdb
·
1 Parent(s): 53f0290

show only text column

Browse files
Files changed (1) hide show
  1. app.py +4 -9
app.py CHANGED
@@ -45,11 +45,6 @@ def predict(texts: list[str]):
45
  return predicted_domains
46
 
47
 
48
- # def progress():
49
- # title = f"Scan finished" if num_rows == next_row_idx else "Scan in progress..."
50
-
51
-
52
-
53
  def plot_and_df(texts, preds):
54
  texts_df = pd.DataFrame({"quality": preds, "text": texts})
55
  counts = Counter(preds)
@@ -62,9 +57,9 @@ def plot_and_df(texts, preds):
62
  # counts.reset_index(inplace=True)
63
  return (
64
  gr.BarPlot(counts_df, x="quality", y="count"),
65
- texts_df[texts_df["quality"] == "Low"][:20],
66
- texts_df[texts_df["quality"] == "Medium"][:20],
67
- texts_df[texts_df["quality"] == "High"][:20],
68
  )
69
 
70
 
@@ -80,7 +75,7 @@ def run_quality_check(dataset, column, batch_size, num_examples):
80
  batch_predictions = predict(batch_texts)
81
  predictions.extend(batch_predictions)
82
  texts_processed.extend(batch_texts)
83
- yield {"scan in progress...": (i+batch_size) / num_examples}, *plot_and_df(texts_processed, predictions)
84
  yield {"finished": 1.}, *plot_and_df(texts_processed, predictions)
85
 
86
  with gr.Blocks() as demo:
 
45
  return predicted_domains
46
 
47
 
 
 
 
 
 
48
  def plot_and_df(texts, preds):
49
  texts_df = pd.DataFrame({"quality": preds, "text": texts})
50
  counts = Counter(preds)
 
57
  # counts.reset_index(inplace=True)
58
  return (
59
  gr.BarPlot(counts_df, x="quality", y="count"),
60
+ texts_df[texts_df["quality"] == "Low"][["text"]][:20],
61
+ texts_df[texts_df["quality"] == "Medium"][["text"]][:20],
62
+ texts_df[texts_df["quality"] == "High"][["text"]][:20],
63
  )
64
 
65
 
 
75
  batch_predictions = predict(batch_texts)
76
  predictions.extend(batch_predictions)
77
  texts_processed.extend(batch_texts)
78
+ yield {"check in progress...": (i+batch_size) / num_examples}, *plot_and_df(texts_processed, predictions)
79
  yield {"finished": 1.}, *plot_and_df(texts_processed, predictions)
80
 
81
  with gr.Blocks() as demo: