Spaces:
Sleeping
Sleeping
abdulllah01
commited on
Commit
•
ef7727f
1
Parent(s):
61ff749
Update app.py
Browse files
app.py
CHANGED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
|
3 |
+
|
4 |
+
# Load the model and tokenizer from your Hugging Face Hub repository
|
5 |
+
model_name = "abdulllah01/tech-support-bot" # Replace with your Hugging Face repo name
|
6 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
7 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
8 |
+
|
9 |
+
# Initialize the pipeline for text generation
|
10 |
+
qa_pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
11 |
+
|
12 |
+
# Streamlit interface
|
13 |
+
st.title("Tech Support Chatbot")
|
14 |
+
st.write("Ask your technical support questions below:")
|
15 |
+
|
16 |
+
# Text input for the question
|
17 |
+
user_input = st.text_input("Your question:", "")
|
18 |
+
|
19 |
+
if user_input:
|
20 |
+
# Generate a response using the pipeline
|
21 |
+
response = qa_pipeline(user_input, max_length=100, num_return_sequences=1)
|
22 |
+
answer = response[0]["generated_text"]
|
23 |
+
st.write("**Answer:**", answer)
|