YchKhan commited on
Commit
c0ba4d5
·
verified ·
1 Parent(s): afd515e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -0
app.py CHANGED
@@ -691,6 +691,38 @@ def generate_prior_art():
691
  print(f"Error generating prior art: {e}")
692
  return jsonify({'error': str(e), 'results': []})
693
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
694
 
695
  if __name__ == '__main__':
696
  app.run(host="0.0.0.0", port=7860)
 
691
  print(f"Error generating prior art: {e}")
692
  return jsonify({'error': str(e), 'results': []})
693
 
694
+ @app.route('/evaluate-problem-descriptions', methods=['POST'])
695
+ def evaluate_problem_descriptions():
696
+ data = request.json
697
+ if not data or 'problem_descriptions' not in data:
698
+ return jsonify({'error': 'Missing required parameters', 'results': []})
699
+
700
+ try:
701
+ problem_descriptions = data['problem_descriptions']
702
+
703
+ # Make a request to the external API
704
+ API_URL = "https://organizedprogrammers-fastapi-kig.hf.space"
705
+ endpoint = f"{API_URL}/evaluate_problem_descriptions"
706
+ api_data = {
707
+ "problem_descriptions": problem_descriptions
708
+ }
709
+
710
+ # Disable SSL warnings for development environment
711
+ urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
712
+
713
+ response = requests.post(endpoint, json=api_data, verify=False)
714
+ if response.status_code == 200:
715
+ result = response.json()
716
+ return jsonify(result)
717
+ else:
718
+ return jsonify({
719
+ 'error': f"API Error: {response.status_code}",
720
+ 'results': []
721
+ })
722
+
723
+ except Exception as e:
724
+ print(f"Error evaluating problem descriptions: {e}")
725
+ return jsonify({'error': str(e), 'results': []})
726
 
727
  if __name__ == '__main__':
728
  app.run(host="0.0.0.0", port=7860)