keerthi-balaji commited on
Commit
89a4d2e
·
verified ·
1 Parent(s): c04dbfe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -12,9 +12,13 @@ class CustomHoroscopeRetriever(RagRetriever):
12
  self.horoscope_data = horoscope_data
13
 
14
  def retrieve(self, question_texts, n_docs=1):
15
- # Convert the input to a list of strings
16
- question_texts = question_texts.tolist()
17
- zodiac_sign = question_texts[0].capitalize()
 
 
 
 
18
  if zodiac_sign in self.horoscope_data:
19
  return [self.horoscope_data[zodiac_sign]]
20
  else:
@@ -37,5 +41,5 @@ def horoscope_chatbot(input_text):
37
  # Set up Gradio interface
38
  iface = gr.Interface(fn=horoscope_chatbot, inputs="text", outputs="text", title="Horoscope RAG Chatbot")
39
 
40
- # Launch the interface
41
- iface.launch()
 
12
  self.horoscope_data = horoscope_data
13
 
14
  def retrieve(self, question_texts, n_docs=1):
15
+ # Ensure question_texts is a list of strings
16
+ if isinstance(question_texts, list):
17
+ question_texts = question_texts[0] # Get the first element
18
+ if isinstance(question_texts, list): # If it's still a list, get the first string
19
+ question_texts = question_texts[0]
20
+
21
+ zodiac_sign = question_texts.capitalize() # Now it should be a string
22
  if zodiac_sign in self.horoscope_data:
23
  return [self.horoscope_data[zodiac_sign]]
24
  else:
 
41
  # Set up Gradio interface
42
  iface = gr.Interface(fn=horoscope_chatbot, inputs="text", outputs="text", title="Horoscope RAG Chatbot")
43
 
44
+ # Launch the interface with public link
45
+ iface.launch(share=True)