srinuksv commited on
Commit
287c828
1 Parent(s): 8b9432f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -13
app.py CHANGED
@@ -83,26 +83,34 @@ def handle_query(query):
83
  print("Processing PDF ingestion from directory:", PDF_DIRECTORY)
84
  data_ingestion_from_directory()
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  # Function to handle queries
87
  def chatbot_handler(query):
88
  response = handle_query(query)
89
  return response
90
 
91
- # Create the Gradio interface with streaming capabilities
92
  interface = gr.Interface(
93
  fn=chatbot_handler,
94
- inputs=gr.Textbox(label="Input", placeholder="Type your message here..."),
95
- outputs=gr.Textbox(label="Output", placeholder="Bot's response will appear here..."),
96
- live=True, # Enable streaming
97
- title="RedfernsTech Streaming Q&A Chatbot",
98
- description="Ask me anything about the uploaded document. I'll provide answers based on our conversation history.",
99
- theme="compact", # Change the theme if desired
100
- examples=[
101
- ["What are the benefits of using Python for data analysis?"],
102
- ["How can I improve my website's performance?"],
103
- ["Tell me about the latest trends in AI."]
104
- ]
105
  )
106
 
107
  # Launch the Gradio interface
108
- interface.launch(share=True)
 
83
  print("Processing PDF ingestion from directory:", PDF_DIRECTORY)
84
  data_ingestion_from_directory()
85
 
86
+ # Define the input and output components for the Gradio interface
87
+ input_component = gr.Textbox(
88
+ label="User:",
89
+ placeholder="Type your message...",
90
+ lines=2
91
+ )
92
+
93
+ output_component = gr.Textbox(
94
+ label="Bot:",
95
+ placeholder="Bot's response will appear here...",
96
+ readonly=True,
97
+ lines=2
98
+ )
99
+
100
  # Function to handle queries
101
  def chatbot_handler(query):
102
  response = handle_query(query)
103
  return response
104
 
105
+ # Create the Gradio interface with chat-like settings
106
  interface = gr.Interface(
107
  fn=chatbot_handler,
108
+ inputs=input_component,
109
+ outputs=output_component,
110
+ title="RedfernsTech Chatbot",
111
+ theme="compact",
112
+ live=True # Enables real-time updates
 
 
 
 
 
 
113
  )
114
 
115
  # Launch the Gradio interface
116
+ interface.launch()