| |
| """app.ipynb |
| |
| Automatically generated by Colab. |
| |
| Original file is located at |
| https://colab.research.google.com/drive/14A4bTrBIYxd8EGljvdL540Y3NO-maA06 |
| """ |
|
|
| |
| import streamlit as st |
| from transformers import pipeline |
|
|
| |
| @st.cache_resource |
| def load_pipeline(): |
| return pipeline("text2text-generation", model="google/flan-t5-small") |
|
|
| chatbot = load_pipeline() |
|
|
| |
| st.title("Your Topic Chatbot 🤖") |
| st.write("Ask me anything about [Your Topic]!") |
|
|
| user_input = st.text_input("You:", "") |
|
|
| if st.button("Ask"): |
| if user_input: |
| response = chatbot(f"Answer the following question: {user_input}", max_length=100) |
| st.success(response[0]['generated_text']) |