Srinivasulu kethanaboina commited on
Commit
d76e8da
·
verified ·
1 Parent(s): 6097399

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -93,7 +93,7 @@ def handle_query(query):
93
  print("Processing PDF ingestion from directory:", PDF_DIRECTORY)
94
  data_ingestion_from_directory()
95
 
96
- def predict(message, history,request: gr.Request):
97
  logo_html = '''
98
  <div class="circle-logo">
99
  <img src="https://rb.gy/8r06eg" alt="FernAi">
@@ -101,7 +101,7 @@ def predict(message, history,request: gr.Request):
101
  '''
102
  # Use the gradio_client API to process the chat history and IP address
103
  response = client.predict(
104
- ip_address=str(request.client.host), # Replace with actual IP address handling if needed
105
  chat_history=message,
106
  api_name="/predict"
107
  )
@@ -109,13 +109,13 @@ def predict(message, history,request: gr.Request):
109
  return response_with_logo
110
 
111
  # Define your Gradio chat interface function (replace with your actual logic)
112
- def chat_interface(message, history):
113
  try:
114
  # Generate a unique session ID for this chat session
115
  session_id = str(uuid.uuid4())
116
-
117
  # Process the user message and generate a response
118
- response = predict(message, history)
119
 
120
  # Capture the message data
121
  message_data = {
 
93
  print("Processing PDF ingestion from directory:", PDF_DIRECTORY)
94
  data_ingestion_from_directory()
95
 
96
+ def predict(message, history,req):
97
  logo_html = '''
98
  <div class="circle-logo">
99
  <img src="https://rb.gy/8r06eg" alt="FernAi">
 
101
  '''
102
  # Use the gradio_client API to process the chat history and IP address
103
  response = client.predict(
104
+ ip_address=str(req), # Replace with actual IP address handling if needed
105
  chat_history=message,
106
  api_name="/predict"
107
  )
 
109
  return response_with_logo
110
 
111
  # Define your Gradio chat interface function (replace with your actual logic)
112
+ def chat_interface(message, history,request: gr.Request):
113
  try:
114
  # Generate a unique session ID for this chat session
115
  session_id = str(uuid.uuid4())
116
+ req=request.client.host
117
  # Process the user message and generate a response
118
+ response = predict(message, history,req)
119
 
120
  # Capture the message data
121
  message_data = {