polinaeterna HF staff commited on
Commit
53f0290
·
1 Parent(s): d806dcd

add progress bar

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -2,8 +2,7 @@ import gradio as gr
2
  import polars as pl
3
  from gradio_huggingfacehub_search import HuggingfaceHubSearch
4
  import torch
5
- from holoviews.ipython.widgets import progress
6
- # import spaces
7
  from torch import nn
8
  from transformers import AutoModel, AutoTokenizer, AutoConfig
9
  from huggingface_hub import PyTorchModelHubMixin
@@ -33,7 +32,7 @@ model = QualityModel.from_pretrained("nvidia/quality-classifier-deberta").to(dev
33
  model.eval()
34
 
35
 
36
- # @spaces.GPU
37
  def predict(texts: list[str]):
38
  inputs = tokenizer(
39
  texts, return_tensors="pt", padding="longest", truncation=True
@@ -112,7 +111,7 @@ with gr.Blocks() as demo:
112
  return gr.HTML(value=html_code)
113
 
114
  text_column = gr.Textbox(placeholder="text", label="Text colum name to check (data must be non-nested, raw texts!)")
115
- batch_size = gr.Slider(0, 128, 64, step=8, label="Batch size (set this to smaller value if this space crashes.)")
116
  num_examples = gr.Number(1000, label="Number of first examples to check")
117
  gr_check_btn = gr.Button("Check Dataset")
118
  progress_bar = gr.Label(show_label=False)
 
2
  import polars as pl
3
  from gradio_huggingfacehub_search import HuggingfaceHubSearch
4
  import torch
5
+ import spaces
 
6
  from torch import nn
7
  from transformers import AutoModel, AutoTokenizer, AutoConfig
8
  from huggingface_hub import PyTorchModelHubMixin
 
32
  model.eval()
33
 
34
 
35
+ @spaces.GPU
36
  def predict(texts: list[str]):
37
  inputs = tokenizer(
38
  texts, return_tensors="pt", padding="longest", truncation=True
 
111
  return gr.HTML(value=html_code)
112
 
113
  text_column = gr.Textbox(placeholder="text", label="Text colum name to check (data must be non-nested, raw texts!)")
114
+ batch_size = gr.Slider(0, 128, 64, step=8, label="Inference batch size (set this to smaller value if this space crashes.)")
115
  num_examples = gr.Number(1000, label="Number of first examples to check")
116
  gr_check_btn = gr.Button("Check Dataset")
117
  progress_bar = gr.Label(show_label=False)