Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from langchain.prompts import PromptTemplate
|
| 3 |
+
from langchain.llms import CTransformers
|
| 4 |
+
|
| 5 |
+
##function to get response from LLAma 2 model
|
| 6 |
+
|
| 7 |
+
def getLLamaresponse(input_text,no_words,blog_style):
|
| 8 |
+
##LLama 2model
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
st.set_page_config(page_title="Generate Blogs",
|
| 16 |
+
page_icon='🙂?',
|
| 17 |
+
layout='centered',
|
| 18 |
+
initial_sidebar_state='collapsed')
|
| 19 |
+
|
| 20 |
+
st.head("Generate Blogs 🙂")
|
| 21 |
+
|
| 22 |
+
input_text=st.text_input("Enter the Blog Topic")
|
| 23 |
+
|
| 24 |
+
#creating 2more columns for additional 2 fields
|
| 25 |
+
col1,col2=st.columns([5,5])
|
| 26 |
+
|
| 27 |
+
with col1:
|
| 28 |
+
no_words=st.text_input('No of Words')
|
| 29 |
+
with col3:
|
| 30 |
+
blog_style=st.selectbox('Writing the blog for',
|
| 31 |
+
('Reseachers',
|
| 32 |
+
'Data Scientists',
|
| 33 |
+
'Common People'),
|
| 34 |
+
index=0)
|
| 35 |
+
|
| 36 |
+
submit=st.button("Generate")
|
| 37 |
+
|
| 38 |
+
##final response
|
| 39 |
+
if submit:
|
| 40 |
+
st.write(getLLamaresponse(input_text,no_words,blog_style))
|