Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import io
|
|
| 4 |
import re
|
| 5 |
import json
|
| 6 |
import os
|
|
|
|
| 7 |
from huggingface_hub import login
|
| 8 |
from dotenv import load_dotenv
|
| 9 |
|
|
@@ -79,7 +80,7 @@ def analyze_resume(pdf_file, job_desc=None, inference_fn=None):
|
|
| 79 |
Return ONLY valid JSON without markdown:"""
|
| 80 |
|
| 81 |
try:
|
| 82 |
-
# Use Together AI inference function
|
| 83 |
result = inference_fn(prompt)
|
| 84 |
return {
|
| 85 |
"score": {"total": total_score, "breakdown": scores},
|
|
@@ -96,12 +97,11 @@ with gr.Blocks(theme=gr.themes.Soft(), fill_height=True) as demo:
|
|
| 96 |
gr.Markdown("Powered by mistralai/Mistral-7B-Instruct-v0.3 via Together AI API. Sign in to use.")
|
| 97 |
button = gr.LoginButton("Sign in")
|
| 98 |
|
| 99 |
-
# Load Mistral-7B from Together AI
|
| 100 |
inference = gr.load(
|
| 101 |
"models/mistralai/Mistral-7B-Instruct-v0.3",
|
| 102 |
accept_token=button,
|
| 103 |
-
provider="together"
|
| 104 |
-
_js="() => ({ max_new_tokens: 300, do_sample: false })" # Pass generation params
|
| 105 |
)
|
| 106 |
|
| 107 |
with gr.Row():
|
|
@@ -120,4 +120,4 @@ with gr.Blocks(theme=gr.themes.Soft(), fill_height=True) as demo:
|
|
| 120 |
queue=True
|
| 121 |
)
|
| 122 |
|
| 123 |
-
demo.launch(
|
|
|
|
| 4 |
import re
|
| 5 |
import json
|
| 6 |
import os
|
| 7 |
+
import gc # Added back for garbage collection
|
| 8 |
from huggingface_hub import login
|
| 9 |
from dotenv import load_dotenv
|
| 10 |
|
|
|
|
| 80 |
Return ONLY valid JSON without markdown:"""
|
| 81 |
|
| 82 |
try:
|
| 83 |
+
# Use Together AI inference function
|
| 84 |
result = inference_fn(prompt)
|
| 85 |
return {
|
| 86 |
"score": {"total": total_score, "breakdown": scores},
|
|
|
|
| 97 |
gr.Markdown("Powered by mistralai/Mistral-7B-Instruct-v0.3 via Together AI API. Sign in to use.")
|
| 98 |
button = gr.LoginButton("Sign in")
|
| 99 |
|
| 100 |
+
# Load Mistral-7B from Together AI (removed _js)
|
| 101 |
inference = gr.load(
|
| 102 |
"models/mistralai/Mistral-7B-Instruct-v0.3",
|
| 103 |
accept_token=button,
|
| 104 |
+
provider="together"
|
|
|
|
| 105 |
)
|
| 106 |
|
| 107 |
with gr.Row():
|
|
|
|
| 120 |
queue=True
|
| 121 |
)
|
| 122 |
|
| 123 |
+
demo.launch(share=True) # Added share=True for public link
|