lunadebruyne commited on
Commit
d953ee7
·
1 Parent(s): e915ee6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -3,11 +3,15 @@ import gradio as gr
3
  def greet(name):
4
  return "Hello " + name + "!"
5
 
6
- def what_happened(text, file_object):
7
  if file_object:
8
  output = "You uploaded a file."
 
 
9
  else:
10
  output = text
 
 
11
  return output
12
 
13
 
@@ -16,11 +20,12 @@ iface = gr.Interface(
16
  inputs=[
17
  gr.Textbox(
18
  label="Enter a sentence",
19
- lines=3,
20
  value="Your name"),
21
  gr.File(
22
- label="Or upload a dataset"
23
- )
 
24
  ],
25
  outputs="text")
26
  iface.launch()
 
3
  def greet(name):
4
  return "Hello " + name + "!"
5
 
6
+ def what_happened(text, file_object, option_list):
7
  if file_object:
8
  output = "You uploaded a file."
9
+ if len(option_list) > 0:
10
+ output = output + "\nYou selected these options:\n- " + "\n- ".join(option_list)
11
  else:
12
  output = text
13
+ if len(option_list) > 0:
14
+ output = output + "\nYou can only select options when uploading a dataset."
15
  return output
16
 
17
 
 
20
  inputs=[
21
  gr.Textbox(
22
  label="Enter a sentence",
23
+ lines=1,
24
  value="Your name"),
25
  gr.File(
26
+ label="Or upload a dataset"),
27
+ gr.CheckboxGroup(
28
+ ["emotion frequencies", "emotion distribution over time", "peaks", "topics"])
29
  ],
30
  outputs="text")
31
  iface.launch()