Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ 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 |
|
9 |
### LLama2 model
|
10 |
llm=CTransformers(model='TheBloke/OpenHermes-2.5-Mistral-7B-GGUF',
|
@@ -28,31 +28,18 @@ def getLLamaresponse(input_text,no_words,blog_style):
|
|
28 |
return response
|
29 |
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
|
|
|
33 |
|
34 |
-
|
35 |
-
st.set_page_config(page_title="Generate Blogs",
|
36 |
-
page_icon='🤖',
|
37 |
-
layout='centered',
|
38 |
-
initial_sidebar_state='collapsed')
|
39 |
-
|
40 |
-
st.header("Generate Blogs 🤖")
|
41 |
-
|
42 |
-
input_text=st.text_input("Enter the Blog Topic")
|
43 |
-
|
44 |
-
## creating to more columns for additonal 2 fields
|
45 |
-
|
46 |
-
col1,col2=st.columns([5,5])
|
47 |
-
|
48 |
-
with col1:
|
49 |
-
no_words=st.text_input('No of Words')
|
50 |
-
with col2:
|
51 |
-
blog_style=st.selectbox('Writing the blog for',
|
52 |
-
('Researchers','Data Scientist','Common People'),index=0)
|
53 |
-
|
54 |
-
submit=st.button("Generate")
|
55 |
-
|
56 |
-
## Final response
|
57 |
-
if submit:
|
58 |
-
st.write(getLLamaresponse(input_text,no_words,blog_style))
|
|
|
4 |
|
5 |
## Function To get response from LLAma 2 model
|
6 |
|
7 |
+
def getLLamaresponse(input_text = "home decoration" ,no_words = 100,blog_style = "lifestyle"):
|
8 |
|
9 |
### LLama2 model
|
10 |
llm=CTransformers(model='TheBloke/OpenHermes-2.5-Mistral-7B-GGUF',
|
|
|
28 |
return response
|
29 |
|
30 |
|
31 |
+
with gr.Blocks() as demo:
|
32 |
+
gr.Markdown("# AI Patient Chatbot")
|
33 |
+
with gr.Group():
|
34 |
+
with gr.Tab("Patient Chatbot"):
|
35 |
+
chatbot = gr.Chatbot()
|
36 |
+
message = gr.Textbox(label="Enter your message to Barry", placeholder="Type here...", lines=2)
|
37 |
+
send_message = gr.Button("Submit")
|
38 |
+
send_message.click(AIPatient, inputs=[message], outputs=[chatbot])
|
39 |
+
save_chatlog = gr.Button("Save Chatlog")
|
40 |
+
#send_message.click(SaveChatlog, inputs=[message], outputs=[chatbot])
|
41 |
|
42 |
|
43 |
+
#message.submit(AIPatient, inputs=[message], outputs=[chatbot])
|
44 |
|
45 |
+
demo.launch(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|