Sreekan commited on
Commit
62f3c8b
·
verified ·
1 Parent(s): 9b99a81

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -1
app.py CHANGED
@@ -1,3 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
2
  import gradio as gr
3
  from huggingface_hub import InferenceClient
@@ -64,7 +95,7 @@ demo = gr.ChatInterface(
64
  if __name__ == "__main__":
65
  demo.launch()
66
 
67
- '''
68
 
69
  import gradio as gr
70
  from langchain.chains import LLMChain
 
1
+ import gradio as gr
2
+
3
+ # Define a function to respond to user input
4
+ def respond(message, history):
5
+ # For this example, we'll just echo the user's message back to them
6
+ response = "You said: " + message
7
+ history.append((message, response))
8
+ return history
9
+
10
+ # Create the Gradio interface
11
+ with gr.Blocks() as demo:
12
+ gr.Markdown("# Chatbot Interface")
13
+ chatbot_interface = gr.Chatbot()
14
+ user_input = gr.Textbox(label="Your Message", placeholder="Type something...")
15
+ submit_btn = gr.Button("Send")
16
+
17
+ # Define the behavior of the submit button
18
+ submit_btn.click(
19
+ fn=respond,
20
+ inputs=[user_input, chatbot_interface],
21
+ outputs=chatbot_interface
22
+ )
23
+
24
+ # Launch the Gradio application
25
+ demo.launch()
26
+
27
+
28
+
29
+
30
+
31
+ '''
32
 
33
  import gradio as gr
34
  from huggingface_hub import InferenceClient
 
95
  if __name__ == "__main__":
96
  demo.launch()
97
 
98
+
99
 
100
  import gradio as gr
101
  from langchain.chains import LLMChain