davanstrien HF staff commited on
Commit
2d1776b
1 Parent(s): 91a155f

add markdown descriptions

Browse files
Files changed (1) hide show
  1. app.py +20 -1
app.py CHANGED
@@ -118,17 +118,31 @@ def predict_subset(model_id, token):
118
  from toolz import frequencies
119
 
120
  df = pd.DataFrame(
121
- {"labels": frequencies(labels).keys(), "freqs": frequencies(labels).values()}
 
 
 
122
  )
123
  return gallery, df
124
 
125
 
126
  with gr.Blocks() as demo:
127
  with gr.Tab("Random image gallery"):
 
 
 
 
 
128
  button = gr.Button("Refresh")
129
  gallery = gr.Gallery().style(grid=9, height="1400")
130
  button.click(return_random_sample, [], [gallery])
131
  with gr.Tab("image search"):
 
 
 
 
 
 
132
  text = gr.Textbox(label="Search for images")
133
  k = gr.Slider(minimum=3, maximum=18, step=1)
134
  button = gr.Button("search")
@@ -143,9 +157,14 @@ with gr.Blocks() as demo:
143
  # csv_file = gr.File("label_studio.csv")
144
  # button.click(dataset.save_to_disk, [], [csv_file])
145
  with gr.Tab("predict"):
 
 
 
 
146
  token = gr.Textbox(label="token", type="password")
147
  model_id = gr.Textbox(label="model_id")
148
  button = gr.Button("predict")
 
149
  plot = gr.BarPlot(x="labels", y="freqs", width=600, height=400, vertical=False)
150
  gallery = gr.Gallery()
151
  button.click(predict_subset, [model_id, token], [gallery, plot])
 
118
  from toolz import frequencies
119
 
120
  df = pd.DataFrame(
121
+ {
122
+ "labels": frequencies(labels).keys(),
123
+ "freqs": frequencies(labels).values(),
124
+ }
125
  )
126
  return gallery, df
127
 
128
 
129
  with gr.Blocks() as demo:
130
  with gr.Tab("Random image gallery"):
131
+ gr.Markdown(
132
+ """## Random image gallery
133
+ This is a random image gallery.
134
+ You can refresh the images by clicking the refresh button."""
135
+ )
136
  button = gr.Button("Refresh")
137
  gallery = gr.Gallery().style(grid=9, height="1400")
138
  button.click(return_random_sample, [], [gallery])
139
  with gr.Tab("image search"):
140
+ gr.Markdown(
141
+ """## Image search
142
+ This is an image search.
143
+ You can search for images by entering a search term and clicking the search button.
144
+ You can also change the number of images to be returned."""
145
+ )
146
  text = gr.Textbox(label="Search for images")
147
  k = gr.Slider(minimum=3, maximum=18, step=1)
148
  button = gr.Button("search")
 
157
  # csv_file = gr.File("label_studio.csv")
158
  # button.click(dataset.save_to_disk, [], [csv_file])
159
  with gr.Tab("predict"):
160
+ gr.Markdown(
161
+ """## Image classification model tester
162
+ You can use this to test out [image classification models](https://huggingface.co/models?pipeline_tag=image-classification) on the Hugging Face Hub. """
163
+ )
164
  token = gr.Textbox(label="token", type="password")
165
  model_id = gr.Textbox(label="model_id")
166
  button = gr.Button("predict")
167
+ gr.Markdown("## Results")
168
  plot = gr.BarPlot(x="labels", y="freqs", width=600, height=400, vertical=False)
169
  gallery = gr.Gallery()
170
  button.click(predict_subset, [model_id, token], [gallery, plot])