Yoon-gu Hwang commited on
Commit
e391d62
·
1 Parent(s): af9d55b

add chatbot with like/dislike

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -64,15 +64,26 @@ def sepia(input_img):
64
  sepia_img /= sepia_img.max()
65
  return sepia_img
66
 
 
 
67
 
 
 
 
 
 
 
 
68
 
69
  demo = gr.TabbedInterface(
70
  [
 
71
  gr.Interface(prime_factors, gr.Textbox("1001"), gr.Textbox()),
72
  gr.Interface(image_orientation, gr.Image(type="pil"), gr.Textbox()),
73
  gr.Interface(sepia, gr.Image(), gr.Image()),
74
  ],
75
  [
 
76
  "Prime Factors",
77
  "Image Orientation Checker",
78
  "Sepia Filter",
 
64
  sepia_img /= sepia_img.max()
65
  return sepia_img
66
 
67
+ def echo(message, history):
68
+ return message
69
 
70
+ def vote(data: gr.LikeData):
71
+ print(data.liked)
72
+
73
+ with gr.Blocks() as chat_ui:
74
+ chatbot = gr.Chatbot(placeholder="<strong>Your Personal Echo-Man</strong><br>Ask Me Anything")
75
+ chatbot.like(vote, None, None)
76
+ gr.ChatInterface(fn=echo, type="messages", chatbot=chatbot, examples=["hello", "hola", "merhaba"], title="Echo Bot")
77
 
78
  demo = gr.TabbedInterface(
79
  [
80
+ chat_ui,
81
  gr.Interface(prime_factors, gr.Textbox("1001"), gr.Textbox()),
82
  gr.Interface(image_orientation, gr.Image(type="pil"), gr.Textbox()),
83
  gr.Interface(sepia, gr.Image(), gr.Image()),
84
  ],
85
  [
86
+ "Chat UI",
87
  "Prime Factors",
88
  "Image Orientation Checker",
89
  "Sepia Filter",