Spaces:
Sleeping
Sleeping
import streamlit as st | |
from transformers import pipeline | |
# Title of the web application | |
st.title('Chest and Physical Limitations LLM Query') | |
# Initialize the model pipeline | |
# Ensure to use the correct model identifier | |
model_name = "Abbeite/chest_and_physical_limitations2" | |
generator = pipeline('text-generation', model=model_name) | |
# User prompt input | |
user_prompt = st.text_area("Enter your prompt here:") | |
# Button to generate text | |
if st.button('Generate'): | |
if user_prompt: | |
# Generate response | |
try: | |
response = generator(user_prompt, max_length=50, clean_up_tokenization_spaces=True) | |
# Display the generated text | |
st.text_area("Response:", value=response[0]['generated_text'], height=250, disabled=True) | |
except Exception as e: | |
st.error(f"Error generating response: {str(e)}") | |
else: | |
st.warning("Please enter a prompt.") | |