smeintadmin commited on
Commit
db3ef14
·
1 Parent(s): a409d6f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -20,9 +20,13 @@ def predict(text):
20
  # Return the label
21
  return "Image Intent" if predicted_class == 1 else "Non-Image Intent"
22
 
 
 
 
 
23
  # Define the Gradio interface
24
  iface = gr.Interface(
25
- fn=predict,
26
  inputs="text",
27
  outputs="text",
28
  live=True, # Enable user history functionality
@@ -35,7 +39,11 @@ iface = gr.Interface(
35
  ["Show me cute cat pictures!"],
36
  ],
37
  theme="huggingface", # Dark mode theme
 
 
 
 
38
  )
39
 
40
  # Launch the interface
41
- iface.launch()
 
20
  # Return the label
21
  return "Image Intent" if predicted_class == 1 else "Non-Image Intent"
22
 
23
+ # Function to display user history
24
+ def history_display(history):
25
+ return "\n".join(f"{data['input']} -> {data['output']}" for data in history)
26
+
27
  # Define the Gradio interface
28
  iface = gr.Interface(
29
+ fn=predict,
30
  inputs="text",
31
  outputs="text",
32
  live=True, # Enable user history functionality
 
39
  ["Show me cute cat pictures!"],
40
  ],
41
  theme="huggingface", # Dark mode theme
42
+ allow_flagging=False, # Disable flagging option
43
+ live_show_history=True, # Show user history
44
+ live_history=True, # Enable user history recording
45
+ history=history_display, # Function to display user history
46
  )
47
 
48
  # Launch the interface
49
+ iface.launch()