File size: 908 Bytes
82b52d5
3f14d46
82b52d5
 
3f14d46
82b52d5
3f14d46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82b52d5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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_limitations"
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.")