Ghmustafa11 commited on
Commit
22efaed
·
verified ·
1 Parent(s): 455ba6d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -0
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ # Title of the application
5
+ st.title("RozigGPT - AI Chatbot")
6
+
7
+ # Introduction message
8
+ st.markdown("""
9
+ Welcome to RozigGPT! 🤖💬
10
+ Chat with this AI assistant and get instant responses.
11
+ """)
12
+
13
+ # Initialize the Hugging Face pipeline for text generation (GPT-2 model)
14
+ generator = pipeline("text-generation", model="gpt-2")
15
+
16
+ # Function to get the bot's response
17
+ def get_bot_response(user_input):
18
+ response = generator(user_input, max_length=150, num_return_sequences=1, no_repeat_ngram_size=2)
19
+ return response[0]['generated_text']
20
+
21
+ # Text input from the user
22
+ user_input = st.text_input("You: ", "")
23
+
24
+ if user_input:
25
+ # Show user input
26
+ st.write(f"You: {user_input}")
27
+
28
+ # Get the bot's response
29
+ bot_response = get_bot_response(user_input)
30
+
31
+ # Show the bot's response
32
+ st.write(f"RozigGPT: {bot_response}")