dogutcu commited on
Commit
f28a9f2
·
verified ·
1 Parent(s): 1ed82c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -10
app.py CHANGED
@@ -65,7 +65,6 @@ def generate_response(user_query, relevant_segment):
65
  """
66
  Generate a response emphasizing the bot's capability to provide information related to composting food.
67
  """
68
- """
69
  try:
70
  system_message = "You are a chatbot specialized in providing information about food composting tips, tricks, and basics."
71
  user_message = f"Here's the information on composting: {relevant_segment}"
@@ -86,16 +85,7 @@ def generate_response(user_query, relevant_segment):
86
  except Exception as e:
87
  print(f"Error in generating response: {e}")
88
  return f"Error in generating response: {e}"
89
- """
90
- # Create pipeline for text generation with confidence scores
91
- generator = pipeline("text-davinci-003", device=0) # Adjust device if needed
92
-
93
- # Generate response and get confidence score
94
- response = generator(query=f"Here's the information on chess: {relevant_segment} {user_query}", max_length=150, temperature=0.2, top_p=1)
95
- generated_text = response[0]['generated_text'].strip()
96
- confidence_score = response[0]['score']
97
 
98
- return generated_text, confidence_score
99
 
100
  def query_model(question):
101
  """
@@ -130,6 +120,7 @@ topics = """
130
  # Define the HTML iframe content
131
  iframe = '''
132
  <iframe style="border-radius:12px" src="https://open.spotify.com/embed/playlist/37i9dQZF1DXdPec7aLTmlC?utm_source=generator" width="100%" height="352" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>
 
133
 
134
  def display_iframe():
135
  return iframe
 
65
  """
66
  Generate a response emphasizing the bot's capability to provide information related to composting food.
67
  """
 
68
  try:
69
  system_message = "You are a chatbot specialized in providing information about food composting tips, tricks, and basics."
70
  user_message = f"Here's the information on composting: {relevant_segment}"
 
85
  except Exception as e:
86
  print(f"Error in generating response: {e}")
87
  return f"Error in generating response: {e}"
 
 
 
 
 
 
 
 
88
 
 
89
 
90
  def query_model(question):
91
  """
 
120
  # Define the HTML iframe content
121
  iframe = '''
122
  <iframe style="border-radius:12px" src="https://open.spotify.com/embed/playlist/37i9dQZF1DXdPec7aLTmlC?utm_source=generator" width="100%" height="352" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>
123
+ '''
124
 
125
  def display_iframe():
126
  return iframe