Spaces:
Sleeping
Sleeping
Create model_consumer.py
Browse files- model_consumer.py +14 -0
model_consumer.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
|
| 3 |
+
# Replace with your actual model repo ID
|
| 4 |
+
#model_id = "prd101-wd/phi1_5-bankingqa-merged"
|
| 5 |
+
|
| 6 |
+
# Create a text generation pipeline
|
| 7 |
+
pipe = pipeline("question-answering", model="prd101-wd/phi1_5-bankingqa-merged")
|
| 8 |
+
|
| 9 |
+
# Test the model with a prompt
|
| 10 |
+
prompt = "I want to open an account with you. What do I need to do?"
|
| 11 |
+
result = pipe(prompt, max_new_tokens=20)
|
| 12 |
+
|
| 13 |
+
# Print the generated text
|
| 14 |
+
print(result[0]["generated_text"])
|