Spaces:
Running
Running
skills
Browse files
app.py
CHANGED
|
@@ -125,7 +125,9 @@ PROMPT = (
|
|
| 125 |
"Extract the following information from the provided text ONLY "
|
| 126 |
"Course Code, Course Name, Credit, Delivery method, Course description, and Topical outline and do not add anything else except the information available in this text. "
|
| 127 |
)
|
| 128 |
-
|
|
|
|
|
|
|
| 129 |
@app.route("/", methods=["GET"])
|
| 130 |
def home():
|
| 131 |
return jsonify({"message": "Welcome to the PDF Extraction API. Use the /extract endpoint to extract information."})
|
|
@@ -145,7 +147,10 @@ def extract_info():
|
|
| 145 |
pdf_text = extract_text_from_pdf(pdf_url)
|
| 146 |
prompt = f"{PROMPT}\n\n{pdf_text}"
|
| 147 |
response = predict_text(prompt)
|
| 148 |
-
|
|
|
|
|
|
|
|
|
|
| 149 |
except Exception as e:
|
| 150 |
return jsonify({"error": str(e)}), 500
|
| 151 |
|
|
|
|
| 125 |
"Extract the following information from the provided text ONLY "
|
| 126 |
"Course Code, Course Name, Credit, Delivery method, Course description, and Topical outline and do not add anything else except the information available in this text. "
|
| 127 |
)
|
| 128 |
+
PROMPT_SKILLS = (
|
| 129 |
+
"Extract the Course name and Primary Skills from this text. "
|
| 130 |
+
)
|
| 131 |
@app.route("/", methods=["GET"])
|
| 132 |
def home():
|
| 133 |
return jsonify({"message": "Welcome to the PDF Extraction API. Use the /extract endpoint to extract information."})
|
|
|
|
| 147 |
pdf_text = extract_text_from_pdf(pdf_url)
|
| 148 |
prompt = f"{PROMPT}\n\n{pdf_text}"
|
| 149 |
response = predict_text(prompt)
|
| 150 |
+
if "skills" == True:
|
| 151 |
+
prompt_skills = f"{PROMPT_SKILLS}\n\n{pdf_text}"
|
| 152 |
+
response_skills = predict_text(prompt_skills)
|
| 153 |
+
return jsonify({"extracted_info": response + response_skills})
|
| 154 |
except Exception as e:
|
| 155 |
return jsonify({"error": str(e)}), 500
|
| 156 |
|