Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,27 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
|
3 |
# Title of the web application
|
4 |
-
st.title('
|
5 |
|
6 |
-
#
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
# Displaying the input back to the user
|
10 |
-
if user_input:
|
11 |
-
st.write(f'You typed: {user_input}')
|
|
|
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_limitations"
|
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.")
|
27 |
|
|
|
|
|
|