atifsial123 commited on
Commit
353ba65
·
verified ·
1 Parent(s): 3b7ef21

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -51,7 +51,8 @@ def process_with_model(pec_number):
51
  inputs = tokenizer(pec_number, return_tensors="pt")
52
  with torch.no_grad():
53
  outputs = model(**inputs)
54
- return outputs.last_hidden_state.mean(dim=1).squeeze().tolist()
 
55
 
56
  # Combine both functions to create a prediction
57
  def predict(pec_number):
@@ -61,7 +62,7 @@ def predict(pec_number):
61
 
62
  name = get_name(pec_number, df)
63
  model_output = process_with_model(pec_number)
64
- return f"Name: {name}\nModel Output: {model_output}"
65
  except Exception as e:
66
  print(f"An error occurred: {e}")
67
  return f"Error: {e}"
@@ -72,7 +73,7 @@ iface = gr.Interface(
72
  inputs=gr.Textbox(lines=1, placeholder="Enter PEC Number..."),
73
  outputs="text",
74
  title="PEC Number to Name Lookup",
75
- description="Enter a PEC number to retrieve the corresponding name and process it with a Hugging Face model."
76
  )
77
 
78
  # Run the Gradio interface
 
51
  inputs = tokenizer(pec_number, return_tensors="pt")
52
  with torch.no_grad():
53
  outputs = model(**inputs)
54
+ # Instead of returning the full model output, return just a simple confirmation
55
+ return "Model processed successfully."
56
 
57
  # Combine both functions to create a prediction
58
  def predict(pec_number):
 
62
 
63
  name = get_name(pec_number, df)
64
  model_output = process_with_model(pec_number)
65
+ return f"Name: {name}" # Only display the name
66
  except Exception as e:
67
  print(f"An error occurred: {e}")
68
  return f"Error: {e}"
 
73
  inputs=gr.Textbox(lines=1, placeholder="Enter PEC Number..."),
74
  outputs="text",
75
  title="PEC Number to Name Lookup",
76
+ description="Enter a PEC number to retrieve the corresponding name."
77
  )
78
 
79
  # Run the Gradio interface