Spaces:
Build error
Build error
Update app.py
Browse files
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
|
|
|
|
| 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}
|
| 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
|
| 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
|