Abbeite commited on
Commit
75c0510
·
verified ·
1 Parent(s): 35a9d06

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ # Title of the web application
5
+ st.title('Chest and Physical Limitations LLM Query')
6
+
7
+ # Initialize the model pipeline
8
+ # Ensure to use the correct model identifier
9
+ model_name = "Abbeite/chest_and_physical_limitations2"
10
+ generator = pipeline('text-generation', model=model_name)
11
+
12
+ # User prompt input
13
+ user_prompt = st.text_area("Enter your prompt here:")
14
+
15
+ # Button to generate text
16
+ if st.button('Generate'):
17
+ if user_prompt:
18
+ # Generate response
19
+ try:
20
+ response = generator(user_prompt, max_length=50, clean_up_tokenization_spaces=True)
21
+ # Display the generated text
22
+ st.text_area("Response:", value=response[0]['generated_text'], height=250, disabled=True)
23
+ except Exception as e:
24
+ st.error(f"Error generating response: {str(e)}")
25
+ else:
26
+ st.warning("Please enter a prompt.")