Spaces:
Sleeping
Sleeping
Commit
•
34df91a
1
Parent(s):
35b2f8b
Update app.py (#2)
Browse files- Update app.py (730c947fbe9084f367a8adbe0b93a8de46f9d09d)
Co-authored-by: M <KarthickAdopleAI@users.noreply.huggingface.co>
app.py
CHANGED
@@ -3,6 +3,7 @@ import openai
|
|
3 |
import PyPDF2
|
4 |
import gradio as gr
|
5 |
import docx
|
|
|
6 |
|
7 |
class CourseGenarator:
|
8 |
def __init__(self):
|
@@ -46,23 +47,21 @@ class CourseGenarator:
|
|
46 |
resume = self.extract_text_from_file(resume_path)
|
47 |
|
48 |
|
49 |
-
#
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
53 |
|
54 |
-
#
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
max_tokens=
|
59 |
-
temperature=0
|
60 |
-
n=1,
|
61 |
-
stop=None,
|
62 |
)
|
63 |
|
64 |
-
|
65 |
-
generated_text = response.choices[0].text.strip()
|
66 |
|
67 |
return generated_text
|
68 |
|
|
|
3 |
import PyPDF2
|
4 |
import gradio as gr
|
5 |
import docx
|
6 |
+
from openai import OpenAI
|
7 |
|
8 |
class CourseGenarator:
|
9 |
def __init__(self):
|
|
|
47 |
resume = self.extract_text_from_file(resume_path)
|
48 |
|
49 |
|
50 |
+
# Create a conversation for the OpenAI chat API
|
51 |
+
conversation = [
|
52 |
+
{"role": "system", "content": "You are a Resume Summarizer."},
|
53 |
+
{"role": "user", "content": f"""Analyze the Given Resume and Summarize {resume}"""}
|
54 |
+
]
|
55 |
|
56 |
+
# Call OpenAI GPT-3.5-turbo
|
57 |
+
chat_completion = self.client.chat.completions.create(
|
58 |
+
model = "gpt-3.5-turbo",
|
59 |
+
messages = conversation,
|
60 |
+
max_tokens=500,
|
61 |
+
temperature=0
|
|
|
|
|
62 |
)
|
63 |
|
64 |
+
generated_text = chat_completion.choices[0].message.content
|
|
|
65 |
|
66 |
return generated_text
|
67 |
|