vivek-acc's picture
Update app.py
17b88d7
raw
history blame
873 Bytes
import streamlit as st
from transformers import pipeline
# Initialize the text generation pipeline
generator = pipeline("text-generation", model="EleutherAI/gpt-neo-2.7B")
print("Pipeline initialized.")
# Streamlit interface
st.title("Manual Test Case Generator")
topic = st.text_input("Enter a topic or subject:")
num_cases = st.number_input("Number of test cases:", min_value=1, max_value=10, value=1)
if st.button("Generate Test Cases"):
if topic:
prompt = f"Generate {num_cases} manual test cases for the topic: {topic}"
print(f"Prompt - {prompt}")
test_cases = generator(prompt, max_length=150, do_sample=True, num_return_sequences=num_cases)
for i, case in enumerate(test_cases):
st.write(f"Test Case {i+1}:")
st.write(case["generated_text"])
else:
st.error("Please enter a topic/subject.")