Update app.py
Browse files524 unmodified lines525526527528529530531532533534535536218 unmodified lines755756757758524 unmodified linesprint(f"Raw relevance score response: {response}") # Debug printtry:score = float(response.strip())final_score = min(max(score, 0.00), 1.00) # Ensure the score is between 0.00 and 1.00print(f"Processed relevance score: {final_score}") # Debug printreturn final_scoreexcept ValueError:print(f"Error parsing relevance score: {response}")return 0.00def ask_question(question, temperature, top_p, repetition_penalty, web_search, google_news_rss):218 unmodified linesclear_button.click(clear_cache, inputs=[], outputs=clear_output)if __name__ == "__main__":demo.launch524 unmodified lines525526527528529530531532533534535536537538539540541218 unmodified lines760761762763524 unmodified linesprint(f"Raw relevance score response: {response}") # Debug printtry:# Extract the score from the responsescore_match = re.search(r'Relevance Score:\s*(\d+\.\d+)', response)if score_match:score = float(score_match.group(1))final_score = min(max(score, 0.00), 1.00) # Ensure the score is between 0.00 and 1.00print(f"Processed relevance score: {final_score}") # Debug printreturn final_scoreelse:raise ValueError("No relevance score found in the response")except ValueError as e:print(f"Error parsing relevance score: {e}")return 0.00def ask_question(question, temperature, top_p, repetition_penalty, web_search, google_news_rss):218 unmodified linesclear_button.click(clear_cache, inputs=[], outputs=clear_output)if __name__ == "__main__":demo.launch()
app.py+12-7