mployd-engineering commited on
Commit
c3fb649
·
verified ·
1 Parent(s): 4571d28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -54,7 +54,6 @@ def load_model():
54
  print("Model fully loaded!")
55
 
56
  # --- Core Inference ---
57
- # Removed @gr.to_gradio_output as it is causing an AttributeError.
58
  def match_cv_jd(cv_text: str, job_description: str) -> dict:
59
  """
60
  Performs the CV-JD matching using the merged Llama 3.1 model.
@@ -157,15 +156,23 @@ with gr.Blocks(title="CV & Job Matcher") as demo:
157
  # The output component for the structured JSON response
158
  output_display = gr.JSON(label="3. Match Output (Structured JSON Response)", scale=1)
159
 
160
- # To enable external API access (e.g., via curl), we explicitly set api_name.
161
- # The public endpoint will be accessible at /api/predict.
162
  analyze_btn.click(
 
 
 
 
 
 
 
 
 
163
  fn=match_cv_jd,
164
  inputs=[cv_input, jd_input],
165
  outputs=output_display,
166
- api_name="predict" # Re-enabling the public API name
167
  )
168
 
 
169
  # --- Launch ---
170
  if __name__ == "__main__":
171
  load_model()
 
54
  print("Model fully loaded!")
55
 
56
  # --- Core Inference ---
 
57
  def match_cv_jd(cv_text: str, job_description: str) -> dict:
58
  """
59
  Performs the CV-JD matching using the merged Llama 3.1 model.
 
156
  # The output component for the structured JSON response
157
  output_display = gr.JSON(label="3. Match Output (Structured JSON Response)", scale=1)
158
 
159
+ # 1. Internal UI Click: Standard Gradio event listener (no api_name)
 
160
  analyze_btn.click(
161
+ fn=match_cv_jd,
162
+ inputs=[cv_input, jd_input],
163
+ outputs=output_display
164
+ )
165
+
166
+ # 2. External API Access: Explicitly define the public API endpoint
167
+ api = gr.API()
168
+ api.post(
169
+ name="predict", # Defines the public endpoint at /api/predict
170
  fn=match_cv_jd,
171
  inputs=[cv_input, jd_input],
172
  outputs=output_display,
 
173
  )
174
 
175
+
176
  # --- Launch ---
177
  if __name__ == "__main__":
178
  load_model()